From 6b44b4a775fe29ecc7bcb7996e086e3bc09e5fd0 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Tue, 17 Sep 2013 11:52:28 +0300 Subject: 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. --- src/xz/coder.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/xz') 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); -- cgit v1.2.3