aboutsummaryrefslogtreecommitdiff
path: root/src/xz/hardware.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2022-04-14 12:59:09 +0300
committerLasse Collin <lasse.collin@tukaani.org>2022-04-14 13:00:40 +0300
commit0adc13bfe32c14f3e4c6ce9f2d4fdf4112ab53f4 (patch)
tree3be604a3828ab11f6286340bec3df3a5ddbe946a /src/xz/hardware.h
parentxz: Changes to --memlimit-compress and --no-adjust. (diff)
downloadxz-0adc13bfe32c14f3e4c6ce9f2d4fdf4112ab53f4.tar.xz
xz: Make -T0 use multithreaded mode on single-core systems.
The main problem withi the old behavior is that the compressed output is different on single-core systems vs. multicore systems. This commit fixes it by making -T0 one thread in multithreaded mode on single-core systems. The downside of this is that it uses more memory. However, if --memlimit-compress is used, xz can (thanks to the previous commit) drop to the single-threaded mode still.
Diffstat (limited to 'src/xz/hardware.h')
-rw-r--r--src/xz/hardware.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/xz/hardware.h b/src/xz/hardware.h
index cefd7d10..1a5a7a67 100644
--- a/src/xz/hardware.h
+++ b/src/xz/hardware.h
@@ -21,6 +21,10 @@ extern void hardware_threads_set(uint32_t threadlimit);
/// Get the maximum number of worker threads.
extern uint32_t hardware_threads_get(void);
+/// Returns true if multithreaded mode should be used for .xz compression.
+/// This can be true even if the number of threads is one.
+extern bool hardware_threads_is_mt(void);
+
/// Set the memory usage limit. There are separate limits for compression,
/// decompression (also includes --list), and multithreaded decompression.