diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2014-06-09 21:21:24 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2014-06-09 21:21:24 +0300 |
commit | 8c19216baccb92d011694590df8a1262da2e980c (patch) | |
tree | 516c3e7b176984ee79be48471be1d64b8b507ea9 /src/xz | |
parent | Update THANKS. (diff) | |
download | xz-8c19216baccb92d011694590df8a1262da2e980c.tar.xz |
xz: Force single-threaded mode when --flush-timeout is used.
Diffstat (limited to 'src/xz')
-rw-r--r-- | src/xz/coder.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c index 027d7d2f..9accecad 100644 --- a/src/xz/coder.c +++ b/src/xz/coder.c @@ -195,6 +195,17 @@ coder_set_compression_settings(void) // Print the selected filter chain. message_filters_show(V_DEBUG, filters); + // Disable encoder threads when --flush-timeout is used because + // the threaded encoder doesn't support LZMA_SYNC_FLUSH. + // FIXME: When LZMA_SYNC_FLUSH is supported, this should be changed. + if (opt_mode == MODE_COMPRESS && opt_flush_timeout != 0 + && hardware_threads_get() > 1) { + message(V_WARNING, _("Switching to single-threaded mode " + "due to --flush-timeout=%" PRIu64), + opt_flush_timeout); + hardware_threads_set(1); + } + // Get the memory usage. Note that if --format=raw was used, // we can be decompressing. const uint64_t memory_limit = hardware_memlimit_get(opt_mode); |