7
New bug fixes in this release since 2.8.0 have NOT been applied to the
10
Version 1 no longer maintained
11
------------------------------
12
The 1.x.x series is no longer maintained. However, if you really need a
13
version 1, the differences between 1.11.0 and 2.7.0 are very small, mainly
14
revolving around the pthread_once_t_ struct. Those differences applied
15
as a patch to the current 2.x.x should work. Don't forget to change
16
the version numbering in pthread.h before building. If you distribute
17
such a version 1.x.x please bear in mind that your numbers may clash
18
with those of others doing the same thing. Please consider also making
19
identifying changes in version.rc to differentiate your build.
21
Testing and verification
22
------------------------
23
This release has been tested on UP and SMP architectures. Thanks to Tim
24
Theisen for running the Win32 SMP tests.
28
Various modifications and fixes to build and test for WinCE.
29
- Marcel Ruff, Sinan Kaya
31
Fix pthread_cond_destroy() - should not be a cancellation point. Other
32
minor build problems fixed.
35
Remove potential deadlock condition from pthread_cond_destroy().
38
Various modifications to build and test for Win64.
41
Various fixes to the QueueUserAPCEx async cancellation helper DLL
42
and pthreads code cleanups.
43
- Sebastian Gottschalk
45
Removed potential NULL pointer reference.
55
New bug fixes in this release since 2.7.0 have not been applied to the
56
version 1.x.x series. It is probably time to drop version 1.
58
Testing and verification
59
------------------------
60
This release has not yet been tested on SMP architechtures. All tests pass
61
on a uni-processor system.
65
Sem_destroy could return EBUSY even though no threads were waiting on the
66
semaphore. Other races around invalidating semaphore structs (internally)
67
have been removed as well.
71
semaphore5.c - tests the bug fix referred to above.
80
All new features in this release have been back-ported in release 1.11.0,
81
including the incorporation of MCS locks in pthread_once, however, versions
82
1 and 2 remain incompatible even though they are now identical in
83
performance and functionality.
85
Testing and verification
86
------------------------
87
This release has been tested (passed the test suite) on both uni-processor
88
and multi-processor systems.
93
Pthread_once has been re-implemented to remove priority boosting and other
94
complexity to improve robustness. Races for Win32 handles that are not
95
recycle-unique have been removed. The general form of pthread_once is now
96
the same as that suggested earlier by Alexander Terekhov, but instead of the
97
'named mutex', a queue-based lock has been implemented which has the required
98
properties of dynamic self initialisation and destruction. This lock is also
99
efficient. The ABI is unaffected in as much as the size of pthread_once_t has
100
not changed and PTHREAD_ONCE_INIT has not changed, however, applications that
101
peek inside pthread_once_t, which is supposed to be opaque, will break.
106
* Support for Mingw cross development tools added to GNUmakefile.
107
Mingw cross tools allow building the libraries on Linux.
117
All of the bug fixes and new features in this release have been
118
back-ported in release 1.10.0.
120
Testing and verification
121
------------------------
122
This release has been tested (passed the test suite) on both uni-processor
123
and multi-processor systems. Thanks to Tim Theisen at TomoTherapy for
124
exhaustively running the MP tests and for providing crutial observations
125
and data when faults are detected.
130
* pthread_detach() now reclaims remaining thread resources if called after
131
the target thread has terminated. Previously, this routine did nothing in
137
* detach1.c - tests that pthread_detach properly invalidates the target
138
thread, which indicates that the thread resources have been reclaimed.
148
The package now includes a reference documentation set consisting of
149
HTML formatted Unix-style manual pages that have been edited for
150
consistency with Pthreads-w32. The set can also be read online at:
151
http://sources.redhat.com/pthreads-win32/manual/index.html
153
Thanks again to Tim Theisen for running the test suite pre-release
156
All of the bug fixes and new features in this release have been
157
back-ported in release 1.9.0.
162
* Thread Specific Data (TSD) key management has been ammended to
163
eliminate a source of (what was effectively) resource leakage (a HANDLE
164
plus memory for each key destruct routine/thread association). This was
165
not a true leak because these resources were eventually reclaimed when
166
pthread_key_delete was run AND each thread referencing the key had exited.
167
The problem was that these two conditions are often not met until very
168
late, and often not until the process is about to exit.
170
The ammended implementation avoids the need for the problematic HANDLE
171
and reclaims the memory as soon as either the key is deleted OR the
172
thread exits, whichever is first.
174
Thanks to Richard Hughes at Aculab for identifying and locating the leak.
176
* TSD key destructors are now processed up to PTHREAD_DESTRUCTOR_ITERATIONS
177
times instead of just once. PTHREAD_DESTRUCTOR_ITERATIONS has been
178
defined in pthread.h for some time but not used.
180
* Fix a semaphore accounting race between sem_post/sem_post_multiple
181
and sem_wait cancellation. This is the same issue as with
182
sem_timedwait that was fixed in the last release.
184
* sem_init, sem_post, and sem_post_multiple now check that the
185
semaphore count never exceeds _POSIX_SEM_VALUE_MAX.
187
* Although sigwait() is nothing more than a no-op, it should at least
188
be a cancellation point to be consistent with the standard.
193
* stress1.c - attempts to expose problems in condition variable
194
and semaphore timed wait logic. This test was inspired by Stephan
195
Mueller's sample test code used to identify the sem_timedwait bug
196
from the last release. It's not a part of the regular test suite
197
because it can take awhile to run. To run it:
198
nmake clean VC-stress
200
* tsd2.c - tests that key destructors are re-run if the tsd key value is
201
not NULL after the destructor routine has run. Also tests that
202
pthread_setspecific() and pthread_getspecific() are callable from
213
There is now no plan to release a version 3.0.0 to fix problems in
214
pthread_once(). Other possible implementations of pthread_once
215
will still be investigated for a possible future release in an attempt
216
to reduce the current implementation's complexity.
218
All of the bug fixes and new features in this release have been
219
back-ported for release 1.8.0.
224
* Fixed pthread_once race (failures on an MP system). Thanks to
225
Tim Theisen for running exhaustive pre-release testing on his MP system
226
using a range of compilers:
229
Intel C++ version 8.0
231
Some minor speed improvements were also done.
233
* Fix integer overrun error in pthread_mutex_timedlock() - missed when
234
sem_timedwait() was fixed in release 2.2.0. This routine no longer returns
235
ENOTSUP when NEED_SEM is defined - it is supported (NEED_SEM is only
236
required for WinCE versions prior to 3.0).
238
* Fix timeout bug in sem_timedwait().
239
- Thanks to Stephan Mueller for reporting, providing diagnostic output
242
* Fix several problems in the NEED_SEM conditionally included code.
243
NEED_SEM included code is provided for systems that don't implement W32
244
semaphores, such as WinCE prior to version 3.0. An alternate implementation
245
of POSIX semaphores is built using W32 events for these systems when
246
NEED_SEM is defined. This code has been completely rewritten in this
247
release to reuse most of the default POSIX semaphore code, and particularly,
248
to implement all of the sem_* routines supported by pthreads-win32. Tim
249
Theisen also run the test suite over the NEED_SEM code on his MP system. All
252
* The library now builds without errors for the Borland Builder 5.5 compiler.
257
* pthread_mutex_timedlock() and all sem_* routines provided by
258
pthreads-win32 are now implemented for WinCE versions prior to 3.0. Those
259
versions did not implement W32 semaphores. Define NEED_SEM in config.h when
260
building the library for these systems.
262
Known issues in this release
263
----------------------------
265
* pthread_once is too complicated - but it works as far as testing can
268
* The Borland version of the dll fails some of the tests with a memory read
269
exception. The cause is not yet known but a compiler bug has not been ruled
280
Release 1.7.0 is a backport of features and bug fixes new in
281
this release. See earlier notes under Release 2.0.0/General.
286
* Fixed pthread_once potential for post once_routine cancellation
287
hanging due to starvation. See comments in pthread_once.c.
288
Momentary priority boosting is used to ensure that, after a
289
once_routine is cancelled, the thread that will run the
290
once_routine is not starved by higher priority waiting threads at
291
critical times. Priority boosting occurs only AFTER a once_routine
292
cancellation, and is applied only to that once_control. The
293
once_routine is run at the thread's normal base priority.
298
* once4.c: Aggressively tests pthread_once() under realtime
299
conditions using threads with varying priorities. Windows'
300
random priority boosting does not occur for threads with realtime
311
* Added makefile targets to build static link versions of the library.
312
Both MinGW and MSVC. Please note that this does not imply any change
313
to the LGPL licensing, which still imposes psecific conditions on
314
distributing software that has been statically linked with this library.
316
* There is a known bug in pthread_once(). Cancellation of the init_routine
317
exposes a potential starvation (i.e. deadlock) problem if a waiting thread
318
has a higher priority than the initting thread. This problem will be fixed
319
in version 3.0.0 of the library.
324
* Fix integer overrun error in sem_timedwait().
327
* Fix preprocessor directives for static linking.
338
* Reverse change to pthread_setcancelstate() in 2.0.0.
348
This release represents an ABI change and the DLL version naming has
349
incremented from 1 to 2, e.g. pthreadVC2.dll.
351
Version 1.4.0 back-ports the new functionality included in this
352
release. Please distribute DLLs built from that version with updates
353
to applications built on pthreads-win32 version 1.x.x.
355
The package naming has changed, replacing the snapshot date with
356
the version number + descriptive information. E.g. this
357
release is "pthreads-w32-2-0-0-release".
362
* pthread_setcancelstate() no longer checks for a pending
363
async cancel event if the library is using alertable async
364
cancel. See the README file (Prerequisites section) for info
365
on adding alertable async cancelation.
370
* pthread_once() now supports init_routine cancellability.
375
* Agressively test pthread_once() init_routine cancellability.
385
* Implicitly created threads leave Win32 handles behind after exiting.
388
* pthread_once() starvation problem.
394
* More intense testing of pthread_once().
404
* Attempted acquisition of a recursive mutex could cause waiting threads
405
to not be woken when the mutex was released.
406
- Ralf Kubis <RKubis at mc.com>
408
* Various package omissions have been fixed.
418
* Unlocking recursive or errorcheck mutexes would sometimes
419
unexpectedly return an EPERM error (bug introduced in
420
snapshot-2004-11-03).
421
- Konstantin Voronkov <beowinkle at yahoo.com>
428
This snapshot primarily fixes the condvar bug introduced in
429
snapshot-2004-11-03. DLL versioning has also been included to allow
430
applications to runtime check the Microsoft compatible DLL version
431
information, and to extend the DLL naming system for ABI and major
432
(non-backward compatible) API changes. See the README file for details.
437
* Condition variables no longer deadlock (bug introduced in
438
snapshot-2004-11-03).
439
- Alexander Kotliarov and Nicolas at saintmac
441
* DLL naming extended to avoid 'DLL hell' in the future, and to
442
accommodate the ABI change introduced in snapshot-2004-11-03. Snapshot
443
2004-11-03 will be removed from FTP sites.
448
* A Microsoft-style version resource has been added to the DLL for
449
applications that wish to check DLL compatibility at runtime.
451
* Pthreads-win32 DLL naming has been extended to allow incompatible DLL
452
versions to co-exist in the same filesystem. See the README file for details,
453
but briefly: while the version information inside the DLL will change with
454
each release from now on, the DLL version names will only change if the new
455
DLL is not backward compatible with older applications.
457
The versioning scheme has been borrowed from GNU Libtool, and the DLL
458
naming scheme is from Cygwin. Provided the Libtool-style numbering rules are
459
honoured, the Cygwin DLL naming scheme automatcally ensures that DLL name
460
changes are minimal and that applications will not load an incompatible
463
Those who use the pre-built DLLs will find that the DLL/LIB names have a new
464
suffix (1) in this snapshot. E.g. pthreadVC1.dll etc.
466
* The POSIX thread ID reuse uniqueness feature introduced in the last snapshot
467
has been kept as default, but the behaviour can now be controlled when the DLL
468
is built to effectively switch it off. This makes the library much more
469
sensitive to applications that assume that POSIX thread IDs are unique, i.e.
470
are not strictly compliant with POSIX. See the PTW32_THREAD_ID_REUSE_INCREMENT
471
macro comments in config.h for details.
475
Certain POSIX macros have changed.
477
These changes are intended to conform to the Single Unix Specification version 3,
478
which states that, if set to 0 (zero) or not defined, then applications may use
479
sysconf() to determine their values at runtime. Pthreads-win32 does not
482
The following macros are no longer undefined, but defined and set to -1
485
_POSIX_THREAD_ATTR_STACKADDR
486
_POSIX_THREAD_PRIO_INHERIT
487
_POSIX_THREAD_PRIO_PROTECT
488
_POSIX_THREAD_PROCESS_SHARED
490
The following macros are defined and set to 200112L (implemented):
493
_POSIX_THREAD_SAFE_FUNCTIONS
494
_POSIX_THREAD_ATTR_STACKSIZE
495
_POSIX_THREAD_PRIORITY_SCHEDULING
497
_POSIX_READER_WRITER_LOCKS
501
The following macros are defined and set to appropriate values:
503
_POSIX_THREAD_THREADS_MAX
506
PTHREAD_DESTRUCTOR_ITERATIONS
515
DLLs produced from this snapshot cannot be used with older applications without
516
recompiling the application, due to a change to pthread_t to provide unique POSIX
519
Although this snapshot passes the extended test suite, many of the changes are
520
fairly major, and some applications may show different behaviour than previously,
521
so adopt with care. Hopefully, any changed behaviour will be due to the library
522
being better at it's job, not worse.
527
* pthread_create() no longer accepts NULL as the thread reference arg.
528
A segfault (memory access fault) will result, and no thread will be
531
* pthread_barrier_wait() no longer acts as a cancelation point.
533
* Fix potential race condition in pthread_once()
534
- Tristan Savatier <tristan at mpegtv.com>
536
* Changes to pthread_cond_destroy() exposed some coding weaknesses in several
537
test suite mini-apps because pthread_cond_destroy() now returns EBUSY if the CV
543
* Added for compatibility:
544
PTHREAD_RECURSIVE_MUTEX_INITIALIZER,
545
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER,
546
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
547
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
549
* Initial support for Digital Mars compiler
550
- Anuj Goyal <anuj.goyal at gmail.com>
552
* Faster Mutexes. These have been been rewritten following a model provided by
553
Alexander Terekhov that reduces kernel space checks, and eliminates some additional
554
critical sections used to manage a race between timedlock expiration and unlock.
555
Please be aware that the new mutexes do not enforce strict absolute FIFO scheduling
556
of mutexes, however any out-of-order lock acquisition should be very rare.
558
* Faster semaphores. Following a similar model to mutexes above, these have been
559
rewritten to use preliminary users space checks.
561
* sem_getvalue() now returns the number of waiters.
563
* The POSIX thread ID now has much stronger uniqueness characteristics. The library
564
garrantees not to reuse the same thread ID for at least 2^(wordsize) thread
565
destruction/creation cycles.
570
* semaphore4.c: Tests cancelation of the new sem_wait().
572
* semaphore4t.c: Likewise for sem_timedwait().
574
* rwlock8.c: Tests and times the slow execution paths of r/w locks, and the CVs,
575
mutexes, and semaphores that they're built on.
581
Attempt to add Watcom to the list of compilers that can build the library.
582
This failed in the end due to it's non-thread-aware errno. The library
583
builds but the test suite fails. See README.Watcom for more details.
587
* Bug and memory leak in sem_init()
588
- Alex Blanco <Alex.Blanco at motorola.com>
590
* ptw32_getprocessors() now returns CPU count of 1 for WinCE.
591
- James Ewing <james.ewing at sveasoft.com>
593
* pthread_cond_wait() could be canceled at a point where it should not
594
be cancelable. Fixed.
595
- Alexander Terekhov <TEREKHOV at de.ibm.com>
597
* sem_timedwait() had an incorrect timeout calculation.
598
- Philippe Di Cristo <philipped at voicebox.com>
600
* Fix a memory leak left behind after threads are destroyed.
601
- P. van Bruggen <pietvb at newbridges.nl>
606
- Makoto Kato <raven at oldskool.jp>
608
* True pre-emptive asynchronous cancelation of threads. This is optional
609
and requires that Panagiotis E. Hadjidoukas's QueueUserAPCEx package be
610
installed. This package is included in the pthreads-win32 self-unpacking
611
Zip archive starting from this snapshot. See the README.txt file inside
612
the package for installation details.
614
Note: If you don't use async cancelation in your application, or don't need
615
to cancel threads that are blocked on system resources such as network I/O,
616
then the default non-preemptive async cancelation is probably good enough.
617
However, pthreads-win32 auto-detects the availability of these components
618
at run-time, so you don't need to rebuild the library from source if you
619
change your mind later.
621
All of the advice available in books and elsewhere on the undesirability
622
of using async cancelation in any application still stands, but this
623
feature is a welcome addition with respect to the library's conformance to
629
Cleanup of thread priority management. In particular, setting of thread
630
priority now attempts to map invalid Win32 values within the range returned
631
by sched_get_priority_min/max() to useful values. See README.NONPORTABLE
632
under "Thread priority".
636
* pthread_getschedparam() now returns the priority given by the most recent
637
call to pthread_setschedparam() or established by pthread_create(), as
638
required by the standard. Previously, pthread_getschedparam() incorrectly
639
returned the running thread priority at the time of the call, which may have
640
been adjusted or temporarily promoted/demoted.
642
* sched_get_priority_min() and sched_get_priority_max() now return -1 on error
643
and set errno. Previously, they incorrectly returned the error value directly.
651
* ptw32_cancelableWait() now allows cancelation of waiting implicit POSIX
656
* cancel8.c tests cancelation of Win32 threads waiting at a POSIX cancelation
665
* pthread_self() would free the newly created implicit POSIX thread handle if
666
DuplicateHandle failed instead of recycle it (very unlikely).
668
* pthread_exit() was neither freeing nor recycling the POSIX thread struct
669
for implicit POSIX threads.
671
New feature - Cancelation of/by Win32 (non-POSIX) threads
672
---------------------------------------------------------
673
Since John Bossom's original implementation, the library has allowed non-POSIX
674
initialised threads (Win32 threads) to call pthreads-win32 routines and
675
therefore interact with POSIX threads. This is done by creating an on-the-fly
676
POSIX thread ID for the Win32 thread that, once created, allows fully
677
reciprical interaction. This did not extend to thread cancelation (async or
678
deferred). Now it does.
680
Any thread can be canceled by any other thread (Win32 or POSIX) if the former
681
thread's POSIX pthread_t value is known. It's TSD destructors and POSIX
682
cleanup handlers will be run before the thread exits with an exit code of
683
PTHREAD_CANCELED (retrieved with GetExitCodeThread()).
685
This allows a Win32 thread to, for example, call POSIX CV routines in the same way
686
that POSIX threads would/should, with pthread_cond_wait() cancelability and
687
cleanup handlers (pthread_cond_wait() is a POSIX cancelation point).
689
By adding cancelation, Win32 threads should now be able to call all POSIX
690
threads routines that make sense including semaphores, mutexes, condition
691
variables, read/write locks, barriers, spinlocks, tsd, cleanup push/pop,
692
cancelation, pthread_exit, scheduling, etc.
694
Note that these on-the-fly 'implicit' POSIX thread IDs are initialised as detached
695
(not joinable) with deferred cancelation type. The POSIX thread ID will be created
696
automatically by any POSIX routines that need a POSIX handle (unless the routine
697
needs a pthread_t as a parameter of course). A Win32 thread can discover it's own
698
POSIX thread ID by calling pthread_self(), which will create the handle if
699
necessary and return the pthread_t value.
703
Test the above new feature.
709
This snapshot fixes some accidental corruption to new test case sources.
710
There are no changes to the library source code.
719
* pthread.dsp now uses correct compile flags (/MD).
720
- Viv <vcotirlea@hotmail.com>
722
* pthread_win32_process_detach_np() fixed memory leak.
723
- Steven Reddie <Steven.Reddie@ca.com>
725
* pthread_mutex_destroy() fixed incorrect return code.
726
- Nicolas Barry <boozai@yahoo.com>
728
* pthread_spin_destroy() fixed memory leak.
729
- Piet van Bruggen <pietvb@newbridges.nl>
731
* Various changes to tighten arg checking, and to work with later versions of
734
* pthread_getschedparam() etc, fixed dangerous thread validity checking.
735
- Nicolas Barry <boozai@yahoo.com>
737
* POSIX thread handles are now reused and their memory is not freed on thread exit.
738
This allows for stronger thread validity checking.
743
* pthread_kill() added to provide thread validity checking to applications.
744
It does not accept any non zero values for the signal arg.
749
* New test cases to confirm validity checking, pthread_kill(), and thread reuse.
758
* pthread_mutex_trylock() now returns correct error values.
759
pthread_mutex_destroy() will no longer destroy a recursively locked mutex.
760
pthread_mutex_lock() is no longer inadvertantly behaving as a cancelation point.
761
- Thomas Pfaff <tpfaff@gmx.net>
763
* pthread_mutex_timedlock() no longer occasionally sets incorrect mutex
764
ownership, causing deadlocks in some applications.
765
- Robert Strycek <strycek@posam.sk> and Alexander Terekhov <TEREKHOV@de.ibm.com>
774
* sem_getvalue() now returns the correct value under Win NT and WinCE.
775
- Rob Fanner <rfanner@stonethree.com>
777
* sem_timedwait() now uses tighter checks for unreasonable
778
abstime values - that would result in unexpected timeout values.
780
* ptw32_cond_wait_cleanup() no longer mysteriously consumes
781
CV signals but may produce more spurious wakeups. It is believed
782
that the sem_timedwait() call is consuming a CV signal that it
784
- Alexander Terekhov <TEREKHOV@de.ibm.com>
786
* Fixed a memory leak in ptw32_threadDestroy() for implicit threads.
788
* Fixed potential for deadlock in pthread_cond_destroy().
789
A deadlock could occur for statically declared CVs (PTHREAD_COND_INITIALIZER),
790
when one thread is attempting to destroy the condition variable while another
791
is attempting to dynamically initialize it.
792
- Michael Johnson <michaelj@maine.rr.com>
798
Cleanup code default style. (IMPORTANT)
799
----------------------------------------------------------------------
800
Previously, if not defined, the cleanup style was determined automatically
801
from the compiler/language, and one of the following was defined accordingly:
803
__CLEANUP_SEH MSVC only
804
__CLEANUP_CXX C++, including MSVC++, GNU G++
805
__CLEANUP_C C, including GNU GCC, not MSVC
807
These defines determine the style of cleanup (see pthread.h) and,
808
most importantly, the way that cancelation and thread exit (via
809
pthread_exit) is performed (see the routine ptw32_throw() in private.c).
811
In short, the exceptions versions of the library throw an exception
812
when a thread is canceled or exits (via pthread_exit()), which is
813
caught by a handler in the thread startup routine, so that the
814
the correct stack unwinding occurs regardless of where the thread
815
is when it's canceled or exits via pthread_exit().
817
In this and future snapshots, unless the build explicitly defines (e.g.
818
via a compiler option) __CLEANUP_SEH, __CLEANUP_CXX, or __CLEANUP_C, then
819
the build NOW always defaults to __CLEANUP_C style cleanup. This style
820
uses setjmp/longjmp in the cancelation and pthread_exit implementations,
821
and therefore won't do stack unwinding even when linked to applications
822
that have it (e.g. C++ apps). This is for consistency with most
823
current commercial Unix POSIX threads implementations. Compaq's TRU64
824
may be an exception (no pun intended) and possible future trend.
826
Although it was not clearly documented before, it is still necessary to
827
build your application using the same __CLEANUP_* define as was
828
used for the version of the library that you link with, so that the
829
correct parts of pthread.h are included. That is, the possible
830
defines require the following library versions:
832
__CLEANUP_SEH pthreadVSE.dll
833
__CLEANUP_CXX pthreadVCE.dll or pthreadGCE.dll
834
__CLEANUP_C pthreadVC.dll or pthreadGC.dll
836
E.g. regardless of whether your app is C or C++, if you link with
837
pthreadVC.lib or libpthreadGC.a, then you must define __CLEANUP_C.
840
THE POINT OF ALL THIS IS: if you have not been defining one of these
841
explicitly, then the defaults as described at the top of this
842
section were being used.
844
THIS NOW CHANGES, as has been explained above, but to try to make this
845
clearer here's an example:
847
If you were building your application with MSVC++ i.e. using C++
848
exceptions and not explicitly defining one of __CLEANUP_*, then
849
__CLEANUP_C++ was automatically defined for you in pthread.h.
850
You should have been linking with pthreadVCE.dll, which does
853
If you now build your application as you had before, pthread.h will now
854
automatically set __CLEANUP_C as the default style, and you will need to
855
link with pthreadVC.dll. Stack unwinding will now NOT occur when a thread
856
is canceled, or the thread calls pthread_exit().
858
Your application will now most likely behave differently to previous
859
versions, and in non-obvious ways. Most likely is that locally
860
instantiated objects may not be destroyed or cleaned up after a thread
863
If you want the same behaviour as before, then you must now define
864
__CLEANUP_C++ explicitly using a compiler option and link with
865
pthreadVCE.dll as you did before.
868
WHY ARE WE MAKING THE DEFAULT STYLE LESS EXCEPTION-FRIENDLY?
869
Because no commercial Unix POSIX threads implementation allows you to
870
choose to have stack unwinding. Therefore, providing it in pthread-win32
871
as a default is dangerous. We still provide the choice but unless
872
you consciously choose to do otherwise, your pthreads applications will
873
now run or crash in similar ways irrespective of the threads platform
874
you use. Or at least this is the hope.
877
WHY NOT REMOVE THE EXCEPTIONS VERSIONS OF THE LIBRARY ALTOGETHER?
878
There are a few reasons:
879
- because there are well respected POSIX threads people who believe
880
that POSIX threads implementations should be exceptions aware and
881
do the expected thing in that context. (There are equally respected
882
people who believe it should not be easily accessible, if it's there
883
at all, for unconditional conformity to other implementations.)
884
- because pthreads-win32 is one of the few implementations that has
885
the choice, perhaps the only freely available one, and so offers
886
a laboratory to people who may want to explore the effects;
887
- although the code will always be around somewhere for anyone who
888
wants it, once it's removed from the current version it will not be
889
nearly as visible to people who may have a use for it.
892
Source module splitting
893
-----------------------
894
In order to enable smaller image sizes to be generated
895
for applications that link statically with the library,
896
most routines have been separated out into individual
899
This is being done in such a way as to be backward compatible.
900
The old source files are reused to congregate the individual
901
routine files into larger translation units (via a bunch of
902
# includes) so that the compiler can still optimise wherever
903
possible, e.g. through inlining, which can only be done
904
within the same translation unit.
906
It is also possible to build the entire library by compiling
907
the single file named "pthread.c", which just #includes all
908
the secondary congregation source files. The compiler
909
may be able to use this to do more inlining of routines.
911
Although the GNU compiler is able to produce libraries with
912
the necessary separation (the -ffunction-segments switch),
913
AFAIK, the MSVC and other compilers don't have this feature.
915
Finally, since I use makefiles and command-line compilation,
916
I don't know what havoc this reorganisation may wreak amongst
917
IDE project file users. You should be able to continue
918
using your existing project files without modification.
921
New non-portable functions
922
--------------------------
923
pthread_num_processors_np():
924
Returns the number of processors in the system that are
925
available to the process, as determined from the processor
928
pthread_timechange_handler_np():
929
To improve tolerance against operator or time service initiated
930
system clock changes.
932
This routine can be called by an application when it
933
receives a WM_TIMECHANGE message from the system. At present
934
it broadcasts all condition variables so that waiting threads
935
can wake up and re-evaluate their conditions and restart
936
their timed waits if required.
937
- Suggested by Alexander Terekhov
942
As Win95 doesn't provide one, the library now contains
943
it's own InterlockedCompareExchange() routine, which is used
944
whenever Windows doesn't provide it. InterlockedCompareExchange()
945
is used to implement spinlocks and barriers, and also in mutexes.
946
This routine relies on the CMPXCHG machine instruction which
947
is not available on i386 CPUs. This library (from snapshot
948
20010712 onwards) is therefore no longer supported on i386
952
New standard routines
953
---------------------
954
For source code portability only - rwlocks cannot be process shared yet.
956
pthread_rwlockattr_init()
957
pthread_rwlockattr_destroy()
958
pthread_rwlockattr_setpshared()
959
pthread_rwlockattr_getpshared()
961
As defined in the new POSIX standard, and the Single Unix Spec version 3:
964
pthread_mutex_timedlock() - Alexander Terekhov and Thomas Pfaff
965
pthread_rwlock_timedrdlock() - adapted from pthread_rwlock_rdlock()
966
pthread_rwlock_timedwrlock() - adapted from pthread_rwlock_wrlock()
969
pthread.h no longer includes windows.h
970
--------------------------------------
973
This was done to prevent conflicts.
975
HANDLE, DWORD, and NULL are temporarily defined within pthread.h if
976
they are not already.
979
pthread.h, sched.h and semaphore.h now use dllexport/dllimport
980
--------------------------------------------------------------
981
Not only to avoid the need for the pthread.def file, but to
982
improve performance. Apparently, declaring functions with dllimport
983
generates a direct call to the function and avoids the overhead
984
of a stub function call.
988
* Fixed potential NULL pointer dereferences in pthread_mutexattr_init,
989
pthread_mutexattr_getpshared, pthread_barrierattr_init,
990
pthread_barrierattr_getpshared, and pthread_condattr_getpshared.
991
- Scott McCaskill <scott@magruder.org>
993
* Removed potential race condition in pthread_mutex_trylock and
995
- Alexander Terekhov <TEREKHOV@de.ibm.com>
997
* The behaviour of pthread_mutex_trylock in relation to
998
recursive mutexes was inconsistent with commercial implementations.
999
Trylock would return EBUSY if the lock was owned already by the
1000
calling thread regardless of mutex type. Trylock now increments the
1001
recursion count and returns 0 for RECURSIVE mutexes, and will
1002
return EDEADLK rather than EBUSY for ERRORCHECK mutexes. This is
1003
consistent with Solaris.
1004
- Thomas Pfaff <tpfaff@gmx.net>
1006
* Found a fix for the library and workaround for applications for
1007
the known bug #2, i.e. where __CLEANUP_CXX or __CLEANUP_SEH is defined.
1008
See the "Known Bugs in this snapshot" section below.
1010
This could be made transparent to applications by replacing the macros that
1011
define the current C++ and SEH versions of pthread_cleanup_push/pop
1012
with the C version, but AFAIK cleanup handlers would not then run in the
1013
correct sequence with destructors and exception cleanup handlers when
1014
an exception occurs.
1016
* Cancelation once started in a thread cannot now be inadvertantly
1017
double canceled. That is, once a thread begins it's cancelation run,
1018
cancelation is disabled and a subsequent cancel request will
1019
return an error (ESRCH).
1021
* errno: An incorrect compiler directive caused a local version
1022
of errno to be used instead of the Win32 errno. Both instances are
1023
thread-safe but applications checking errno after a pthreads-win32
1024
call would be wrong. Fixing this also fixed a bad compiler
1025
option in the testsuite (/MT should have been /MD) which is
1026
needed to link with the correct library MSVCRT.LIB.
1045
- Renamed DLL and LIB files:
1046
pthreadVSE.dll (MS VC++/Structured EH)
1048
pthreadVCE.dll (MS VC++/C++ EH)
1050
pthreadGCE.dll (GNU G++/C++ EH)
1053
Both your application and the pthread dll should use the
1054
same exception handling scheme.
1057
- MSVC++ C++ exception handling.
1059
Some new tests have been added.
1066
- asynchronous cancelation on X86 (Jason Nye)
1067
- Makefile compatible with MS nmake to replace
1069
- GNUmakefile for Mingw32
1070
- tests/Makefile for MS nmake replaces runall.bat
1071
- tests/GNUmakefile for Mingw32
1074
- kernel32 load/free problem
1075
- attempt to hide internel exceptions from application
1076
exception handlers (__try/__except and try/catch blocks)
1077
- Win32 thread handle leakage bug
1078
(David Baggett/Paul Redondo/Eyal Lebedinsky)
1080
Some new tests have been added.
1087
- ctime_r macro had an incorrect argument (Erik Hensema),
1088
- threads were not being created
1089
PTHREAD_CANCEL_DEFERRED. This should have
1090
had little effect as deferred is the only
1091
supported type. (Ross Johnson).
1093
Some compatibility improvements added, eg.
1094
- pthread_setcancelstate accepts NULL pointer
1095
for the previous value argument. Ditto for
1096
pthread_setcanceltype. This is compatible
1097
with Solaris but should not affect
1098
standard applications (Erik Hensema)
1100
Some new tests have been added.
1106
Bug fix - Cancelation of threads waiting on condition variables
1107
now works properly (Lorin Hochstein and Peter Slacik)
1113
Fixed exception stack cleanup if calling pthread_exit()
1114
- (Lorin Hochstein and John Bossom).
1116
Fixed bugs in condition variables - (Peter Slacik):
1117
- additional contention checks
1118
- properly adjust number of waiting threads after timed
1125
Some minor bugs have been fixed. See the ChangeLog file for details.
1127
Some more POSIX 1b functions are now included but ony return an
1128
error (ENOSYS) if called. They are:
1139
Some POSIX 1b functions which were internally supported are now
1140
available as exported functions:
1148
sched_get_priority_min
1149
sched_get_priority_max
1151
Some minor bugs have been fixed. See the ChangeLog file for details.