about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libutil/compression.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc
index 5e2631ba3408..aad6e9b5bc1e 100644
--- a/src/libutil/compression.cc
+++ b/src/libutil/compression.cc
@@ -191,8 +191,13 @@ struct XzSink : CompressionSink
 
     XzSink(Sink & nextSink) : nextSink(nextSink)
     {
-        lzma_ret ret = lzma_easy_encoder(
-            &strm, 6, LZMA_CHECK_CRC64);
+        lzma_mt mt_options = {};
+        mt_options.flags = 0;
+        mt_options.timeout = 300;
+        mt_options.check = LZMA_CHECK_CRC64;
+        mt_options.threads = lzma_cputhreads();
+        lzma_ret ret = lzma_stream_encoder_mt(
+            &strm, &mt_options);
         if (ret != LZMA_OK)
             throw CompressionError("unable to initialise lzma encoder");
         // FIXME: apply the x86 BCJ filter?