aboutsummaryrefslogtreecommitdiff
path: root/src/xz/coder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2013-09-17 11:52:28 +0300
committerLasse Collin <lasse.collin@tukaani.org>2013-09-17 11:52:28 +0300
commit6b44b4a775fe29ecc7bcb7996e086e3bc09e5fd0 (patch)
tree09c42c60abcdf0acde7d83c89d695d3572e17ab7 /src/xz/coder.c
parentBuild: Remove a comment about Automake 1.10 from configure.ac. (diff)
downloadxz-6b44b4a775fe29ecc7bcb7996e086e3bc09e5fd0.tar.xz
Add native threading support on Windows.
Now liblzma only uses "mythread" functions and types which are defined in mythread.h matching the desired threading method. Before Windows Vista, there is no direct equivalent to pthread condition variables. Since this package doesn't use pthread_cond_broadcast(), pre-Vista threading can still be kept quite simple. The pre-Vista code doesn't use anything that wasn't already available in Windows 95, so the binaries should run even on Windows 95 if someone happens to care.
Diffstat (limited to '')
-rw-r--r--src/xz/coder.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c
index 5d422d60..2e76b087 100644
--- a/src/xz/coder.c
+++ b/src/xz/coder.c
@@ -51,7 +51,7 @@ static lzma_check check;
/// This becomes false if the --check=CHECK option is used.
static bool check_default = true;
-#ifdef HAVE_PTHREAD
+#ifdef MYTHREAD_ENABLED
static lzma_mt mt_options = {
.flags = 0,
.timeout = 300,
@@ -200,7 +200,7 @@ coder_set_compression_settings(void)
const uint64_t memory_limit = hardware_memlimit_get(opt_mode);
uint64_t memory_usage;
if (opt_mode == MODE_COMPRESS) {
-#ifdef HAVE_PTHREAD
+#ifdef MYTHREAD_ENABLED
if (opt_format == FORMAT_XZ && hardware_threads_get() > 1) {
mt_options.threads = hardware_threads_get();
mt_options.block_size = opt_block_size;
@@ -245,7 +245,7 @@ coder_set_compression_settings(void)
assert(opt_mode == MODE_COMPRESS);
-#ifdef HAVE_PTHREAD
+#ifdef MYTHREAD_ENABLED
if (opt_format == FORMAT_XZ && mt_options.threads > 1) {
// Try to reduce the number of threads before
// adjusting the compression settings down.
@@ -408,7 +408,7 @@ coder_init(file_pair *pair)
break;
case FORMAT_XZ:
-#ifdef HAVE_PTHREAD
+#ifdef MYTHREAD_ENABLED
if (hardware_threads_get() > 1)
ret = lzma_stream_encoder_mt(
&strm, &mt_options);