📄 changelog
字号:
* config.h (PTW32_THREAD_ID_REUSE_INCREMENT): Added to allow building the library for either unique thread IDs like Solaris or non-unique thread IDs like Linux; allows application developers to override the library's default insensitivity to some apps that may not be strictly POSIX compliant. * version.rc: New resource module to encode version information within the DLL. * pthread.h: Added PTW32_VERSION* defines and grouped sections required by resource compiler together; bulk of file is skipped if RC_INVOKED. Defined some error numbers and other names for Borland compiler.2004-11-02 Ross Johnson <rpj at callisto.canberra.edu.au> * pthread_cond_wait.c (ptw32_cond_wait_cleanup): Lock CV mutex at start of cleanup handler rather than at the end. * implement.h (PTW32_THREAD_REUSE_EMPTY): Renamed from *_BOTTOM. (ptw32_threadReuseBottom): New global variable. * global.c (ptw32_threadReuseBottom): Declare new variable. * ptw32_reuse.c (ptw32_reuse): Change reuse LIFO stack to LILO queue to more evenly distribute use of reusable thread IDs; use renamed PTW32_THREAD_REUSE_EMPTY. * ptw32_processTerminate.c (ptw2_processTerminate): Use renamed PTW32_THREAD_REUSE_EMPTY.2004-10-31 Ross Johnson <rpj at callisto.canberra.edu.au> * implement.h (PThreadState): Add new state value 'PThreadStateCancelPending'. * pthread_testcancel.c (pthread_testcancel): Use new thread 'PThreadStateCancelPending' state as short cut to avoid entering kernel space via WaitForSingleObject() call. This was obviated by user space sema acquisition in sem_wait() and sem_timedwait(), which are also cancelation points. A call to pthread_testcancel() was required, which introduced a kernel call, effectively nullifying any gains made by the user space sem acquisition checks. * pthread_cancel.c (pthread_cancel): Set new thread 'PThreadStateCancelPending' state.2004-10-29 Ross Johnson <rpj at callisto.canberra.edu.au> * implement.h (pthread_t): Renamed to ptw32_thread_t; struct contains all thread state. * pthread.h (ptw32_handle_t): New general purpose struct to serve as a handle for various reusable object IDs - currently only used by pthread_t; contains a pointer to ptw32_thread_t (thread state) and a general purpose uint for use as a reuse counter or flags etc. (pthread_t): typedef'ed to ptw32_handle_t; the uint is the reuse counter that allows the library to maintain unique POSIX thread IDs. When the pthread struct reuse stack was introduced, threads would often acquire an identical ID to a previously destroyed thread. The same was true for the pre-reuse stack library, by virtue of pthread_t being the address of the thread struct. The new pthread_t retains the reuse stack but provides virtually unique thread IDs. * sem_wait.c (ptw32_sem_wait_cleanup): New routine used for cancelation cleanup. * sem_timedwait.c (ptw32_sem_timedwait_cleanup): Likewise.2004-10-22 Ross Johnson <rpj at callisto.canberra.edu.au> * sem_init.c (sem_init): Introduce a 'lock' element in order to replace the interlocked operations with conventional serialisation. This is needed in order to be able to atomically modify the sema value and perform Win32 sema release operations. Win32 semaphores are used instead of events in order to support efficient multiple posting. If the whole modify/release isn't atomic, a race between sem_timedwait() and sem_post() could result in a release when there is no waiting semaphore, which would cause too many threads to proceed. * sem_wait.c (sem_wait): Use new 'lock'element. * sem_timedwait.c (sem_timedwait): Likewise. * sem_trywait.c (sem_trywait): Likewise. * sem_post.c (sem_post): Likewise. * sem_post_multiple.c (sem_post_multiple): Likewise. * sem_getvalue.c (sem_getvalue): Likewise. * ptw32_semwait.c (ptw32_semwait): Likewise. * sem_destroy.c (sem_destroy): Likewise; also tightened the conditions for semaphore destruction; in particular, a semaphore will not be destroyed if it has waiters. * sem_timedwait.c (sem_timedwait): Added cancel cleanup handler to restore sema value when cancelled. * sem_wait.c (sem_wait): Likewise.2004-10-21 Ross Johnson <rpj at callisto.canberra.edu.au> * pthread_mutex_unlock.c (pthread_mutex_unlock): Must use PulseEvent() rather than SetEvent() to reset the event if there are no waiters.2004-10-19 Ross Johnson <rpj at callisto.canberra.edu.au> * sem_init.c (sem_init): New semaphore model based on the same idea as mutexes, i.e. user space interlocked check to avoid unnecessarily entering kernel space. Wraps the Win32 semaphore and keeps it's own counter. Although the motivation to do this has existed for a long time, credit goes to Alexander Terekhov for providing the logic. I have deviated slightly from AT's logic to add the waiters count, which has made the code more complicated by adding cancelation cleanup. This also appears to have broken the VCE (C++ EH) version of the library (the same problem as previously reported - see BUGS #2), only apparently not fixable using the usual workaround, nor by turning all optimisation off. The GCE version works fine, so it is presumed to be a bug in MSVC++ 6.0. The cancelation exception is thrown and caught correctly, but the cleanup class destructor is never called. The failing test is tests\semaphore4.c. * sem_wait.c (sem_wait): Implemented user space check model. * sem_post.c (sem_post): Likewise. * sem_trywait.c (sem_trywait): Likewise. * sem_timedwait.c (sem_timedwait): Likewise. * sem_post_multiple.c (sem_post_multiple): Likewise. * sem_getvalue.c (sem_getvalue): Likewise. * ptw32_semwait.c (ptw32_semwait): Likewise. * implement.h (sem_t_): Add counter element.2004-10-15 Ross Johnson <rpj at callisto.canberra.edu.au> * implement.h (pthread_mutex_t_): Use an event in place of the POSIX semaphore. * pthread_mutex_init.c: Create the event; remove semaphore init. * pthread_mutex_destroy.c: Delete the event. * pthread_mutex_lock.c: Replace the semaphore wait with the event wait. * pthread_mutex_trylock.c: Likewise. * pthread_mutex_timedlock.c: Likewise. * pthread_mutex_unlock.c: Set the event. 2004-10-14 Ross Johnson <rpj at callisto.canberra.edu.au> * pthread_mutex_lock.c (pthread_mutex_lock): New algorithm using Terekhov's xchg based variation of Drepper's cmpxchg model. Theoretically, xchg uses fewer clock cycles than cmpxchg (using IA-32 as a reference), however, in my opinion bus locking dominates the equation on smp systems, so the model with the least number of bus lock operations in the execution path should win, which is Terekhov's variant. On IA-32 uni-processor systems, it's faster to use the CMPXCHG instruction without locking the bus than to use the XCHG instruction, which always locks the bus. This makes the two variants equal for the non-contended lock (fast lane) execution path on up IA-32. Testing shows that the xchg variant is faster on up IA-32 as well if the test forces higher lock contention frequency, even though kernel calls should be dominating the times (on up IA-32, both variants used CMPXCHG instructions and neither locked the bus). * pthread_mutex_timedlock.c pthread_mutex_timedlock(): Similarly. * pthread_mutex_trylock.c (pthread_mutex_trylock): Similarly. * pthread_mutex_unlock.c (pthread_mutex_unlock): Similarly. * ptw32_InterlockedCompareExchange.c (ptw32_InterlockExchange): New function. (PTW32_INTERLOCKED_EXCHANGE): Sets up macro to use inlined ptw32_InterlockedExchange. * implement.h (PTW32_INTERLOCKED_EXCHANGE): Set default to InterlockedExchange(). * Makefile: Building using /Ob2 so that asm sections within inline functions are inlined.2004-10-08 Ross Johnson <rpj at callisto.canberra.edu.au> * pthread_mutex_destroy.c (pthread_mutex_destroy): Critical Section element is no longer required. * pthread_mutex_init.c (pthread_mutex_init): Likewise. * pthread_mutex_lock.c (pthread_mutex_lock): New algorithm following Drepper's paper at http://people.redhat.com/drepper/futex.pdf, but using the existing semaphore in place of the futex described in the paper. Idea suggested by Alexander Terekhov - see: http://sources.redhat.com/ml/pthreads-win32/2003/msg00108.html * pthread_mutex_timedlock.c pthread_mutex_timedlock(): Similarly. * pthread_mutex_trylock.c (pthread_mutex_trylock): Similarly. * pthread_mutex_unlock.c (pthread_mutex_unlock): Similarly. * pthread_barrier_wait.c (pthread_barrier_wait): Use inlined version of InterlockedCompareExchange() if possible - determined at build-time. * pthread_spin_destroy.c pthread_spin_destroy(): Likewise. * pthread_spin_lock.c pthread_spin_lock():Likewise. * pthread_spin_trylock.c (pthread_spin_trylock):Likewise. * pthread_spin_unlock.c (pthread_spin_unlock):Likewise. * ptw32_InterlockedCompareExchange.c: Sets up macro for inlined use. * implement.h (pthread_mutex_t_): Remove Critical Section element. (PTW32_INTERLOCKED_COMPARE_EXCHANGE): Set to default non-inlined version of InterlockedCompareExchange(). * private.c: Include ptw32_InterlockedCompareExchange.c first for inlining. * GNUmakefile: Add commandline option to use inlined InterlockedCompareExchange(). * Makefile: Likewise.2004-09-27 Ross Johnson <rpj at callisto.canberra.edu.au> * pthread_mutex_lock.c (pthread_mutex_lock): Separate PTHREAD_MUTEX_NORMAL logic since we do not need to keep or check some state required by other mutex types; do not check mutex pointer arg for validity - leave this to the system since we are only checking for NULL pointers. This should improve speed of NORMAL mutexes and marginally improve speed of other type. * pthread_mutex_trylock.c (pthread_mutex_trylock): Likewise. * pthread_mutex_unlock.c (pthread_mutex_unlock): Likewise; also avoid entering the critical section for the no-waiters case, with approx. 30% reduction in lock/unlock overhead for this case. * pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise; also no longer keeps mutex if post-timeout second attempt succeeds - this will assist applications that wish to impose strict lock deadlines, rather than simply to escape from frozen locks.2004-09-09 Tristan Savatier <tristan at mpegtv.com> * pthread.h (struct pthread_once_t_): Qualify the 'done' element as 'volatile'. * pthread_once.c: Concerned about possible race condition, specifically on MPU systems re concurrent access to multibyte types. [Maintainer's note: the race condition is harmless on SPU systems and only a problem on MPU systems if concurrent access results in an exception (presumably generated by a hardware interrupt). There are other instances of similar harmless race conditions that have not been identified as issues.]2004-09-09 Ross Johnson <rpj at callisto.canberra.edu.au> * pthread.h: Declare additional types as volatile.2004-08-27 Ross Johnson <rpj at callisto.canberra.edu.au> * pthread_barrier_wait.c (pthread_barrier_wait): Remove excessive code by substituting the internal non-cancelable version of sem_wait (ptw32_semwait).2004-08-25 Ross Johnson <rpj at callisto.canberra.edu.au> * pthread_join.c (pthread_join): Rewrite and re-order the conditional tests in an attempt to improve efficiency and remove a race condition.2004-08-23 Ross Johnson <rpj at callisto.canberra.edu.au> * create.c (pthread_create): Don't create a thread if the thread id pointer location (first arg) is inaccessible. A memory protection fault will result if the thread id arg isn't an accessible location. This is consistent with GNU/Linux but different to Solaris or MKS (and possibly others), which accept NULL as meaning 'don't return the created thread's ID'. Applications that run using pthreads-win32 will run on all other POSIX threads implementations, at least w.r.t. this feature. It was decided not to copy the Solaris et al behaviour because, although it would have simplified some application porting (but only from Solaris to Windows), the feature is not technically necessary, and the alternative segfault behaviour helps avoid buggy application code.2004-07-01 Anuj Goyal <anuj.goyal at gmail.com> * builddmc.bat: New; Windows bat file to build the library. * config.h (__DMC__): Support for Digital Mars compiler. * create.c (__DMC__): Likewise. * pthread_exit.c (__DMC__): Likewise. * pthread_join.c (__DMC__): Likewise. * ptw32_threadDestroy.c (__DMC__): Likewise. * ptw32_threadStart.c (__DMC__): Likewise. * ptw32_throw.c (__DMC__): Likewise.2004-06-29 Anuj Goyal <anuj.goyal at gmail.com> * pthread.h (__DMC__): Initial support for Digital Mars compiler.2004-06-29 Will Bryant <will.bryant at ecosm.com> * README.Borland: New; description of Borland changes. * Bmakefile: New makefile for the Borland make utility. * ptw32_InterlockedCompareExchange.c: Add Borland compatible asm code.2004-06-26 Jason Bard <BardJA at Npt.NUWC.Navy.Mil> * pthread.h (HAVE_STRUCT_TIMESPEC): If undefined, define it to avoid timespec struct redefined errors elsewhere in an application.2004-06-21 Ross Johnson <rpj at callisto.canberra.edu.au> * pthread.h (PTHREAD_RECURSIVE_MUTEX_INITIALIZER): Mutex initialiser added for compatibility with Linux threads and others; currently not included in SUSV3. * pthread.h (PTHREAD_ERRORCHECK_MUTEX_INITIALIZER): Likewise. * pthread.h (PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP): Likewise. * pthread.h (PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP): Likewise. * ptw32_mutex_check_need_init.c (ptw32_mutex_check_need_init): Add new initialisers. * pthread_mutex_lock.c (pthread_mutex_lock): Check for new initialisers. * pthread_mutex_trylock.c (pthread_mutex_trylock): Likewise. * pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise. * pthread_mutex_unlock.c (pthread_mutex_unlock): Likewise. * pthread_mutex_destroy.c (pthread_mutex_destroy): Likewise.2004-05-20 Ross Johnson <rpj at callisto.canberra.edu.au> * README.NONPORTABLE: Document pthread_win32_test_features_np(). * FAQ: Update various answers.2004-05-19 Ross Johnson <rpj at callisto.canberra.edu.au> * Makefile: Don't define _WIN32_WINNT on compiler command line. * GNUmakefile: Likewise.2004-05-16 Ross Johnson <rpj at callisto.canberra.edu.au> * pthread_cancel.c (pthread_cancel): Adapted to use auto-detected QueueUserAPCEx features at run-time. (ptw32_RegisterCancelation): Drop in replacement for QueueUserAPCEx() if it can't be used. Provides older style non-preemptive async cancelation. * pthread_win32_attach_detach_np.c (pthread_win32_attach_np): Auto-detect quserex.dll and the availability of alertdrv.sys; initialise and close on process attach/detach. * global.c (ptw32_register_cancelation): Pointer to either QueueUserAPCEx() or ptw32_RegisterCancelation() depending on availability. QueueUserAPCEx makes pre-emptive async cancelation possible. * implement.h: Add definitions and prototypes related to QueueUserAPC.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -