aboutsummaryrefslogtreecommitdiff
path: root/src/common/mythread.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-11-11Windows: Fix mythread_once() macro with Vista threads.Lasse Collin1-3/+4
Don't call InitOnceComplete() if initialization was already done. So far mythread_once() has been needed only when building with --enable-small. windows/build.bash does this together with --disable-threads so the Vista-specific mythread_once() is never needed by those builds. VS project files or CMake-builds don't support HAVE_SMALL builds at all.
2014-12-21Fix build when --disable-threads is used.Lasse Collin1-0/+2
2014-01-12Fix typos in comments.Lasse Collin1-1/+1
2013-09-17Add native threading support on Windows.Lasse Collin1-111/+402
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.
2012-12-14liblzma: Fix mythread_sync for nested locking.Lasse Collin1-2/+3
2011-05-17Don't use clockid_t in mythread.h when clock_gettime() isn't available.Lasse Collin1-0/+2
Thanks to Wim Lewis for the patch.
2011-04-19Fix portability problems in mythread.h.Lasse Collin1-4/+27
Use gettimeofday() if clock_gettime() isn't available (e.g. Darwin). The test for availability of pthread_condattr_setclock() and CLOCK_MONOTONIC was incorrect. Instead of fixing the #ifdefs, use an Autoconf test. That way if there exists a system that supports them but doesn't specify the matching POSIX #defines, the features will still get detected. Don't try to use pthread_sigmask() on OpenVMS. It doesn't have that function. Guard mythread.h against being #included multiple times.
2011-04-10Revise mythread.h.Lasse Collin1-20/+180
This adds: - mythread_sync() macro to create synchronized blocks - mythread_cond structure and related functions and macros for condition variables with timed waiting using a relative timeout - mythread_create() to create a thread with all signals blocked Some of these wouldn't need to be inline functions, but I'll keep them this way for now for simplicity. For timed waiting on a condition variable, librt is now required on some systems to use clock_gettime(). configure.ac was updated to handle this.
2009-04-13Put the interesting parts of XZ Utils into the public domain.Lasse Collin1-1/+3
Some minor documentation cleanups were made at the same time.
2009-01-07Use pthread_sigmask() instead of sigprocmask() when pthreadsLasse Collin1-0/+6
are enabled.
2008-12-31Remove lzma_init() and other init functions from liblzma API.Lasse Collin1-0/+34
Half of developers were already forgetting to use these functions, which could have caused total breakage in some future liblzma version or even now if --enable-small was used. Now liblzma uses pthread_once() to do the initializations unless it has been built with --disable-threads which make these initializations thread-unsafe. When --enable-small isn't used, liblzma currently gets needlessly linked against libpthread (on systems that have it). While it is stupid for now, liblzma will need threads in future anyway, so this stupidity will be temporary only. When --enable-small is used, different code CRC32 and CRC64 is now used than without --enable-small. This made the resulting binary slightly smaller, but the main reason was to clean it up and to handle the lack of lzma_init_check(). The pkg-config file lzma.pc was renamed to liblzma.pc. I'm not sure if it works correctly and portably for static linking (Libs.private includes -pthread or other operating system specific flags). Hopefully someone complains if it is bad. lzma_rc_prices[] is now included as a precomputed array even with --enable-small. It's just 128 bytes now that it uses uint8_t instead of uint32_t. Smaller array seemed to be at least as fast as the more bloated uint32_t array on x86; hopefully it's not bad on other architectures.