From 37f6fe772e5779120d2ee372c5d51ff60b6801dc Mon Sep 17 00:00:00 2001 From: rpj Date: Wed, 16 Mar 2005 01:33:20 +0000 Subject: '' --- ANNOUNCE | 15 +-- BUGS | 11 +- CONTRIBUTORS | 236 ++++++++++++++++++++------------------- ChangeLog | 49 ++++---- NEWS | 62 ++++++++-- global.c | 8 +- pthread_setcancelstate.c | 2 + pthread_win32_attach_detach_np.c | 1 - tests/ChangeLog | 7 +- tests/mutex5.c | 18 +-- tests/test.h | 9 +- 11 files changed, 240 insertions(+), 178 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 32d58c3..a461083 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,16 +1,11 @@ - PTHREADS-WIN32 SNAPSHOT 2005-03-08 - ---------------------------------- + PTHREADS-WIN32 RELEASE 1.4.0 (2005-03-16) + ------------------------------------------- Web Site: http://sources.redhat.com/pthreads-win32/ FTP Site: ftp://sources.redhat.com/pub/pthreads-win32 Maintainer: Ross Johnson -[Please note: snapshots from 2004-11-03 are using a new mutex implementation -and should be regarded as beta code. You may not want to use it in production -yet but please try it if you can. No mutex related problems have been reported -since snapshot 2005-01-25.] - -We are pleased to announce the availability of a new snapshot of +We are pleased to announce the availability of a new release of Pthreads-win32, an Open Source Software implementation of the Threads component of the POSIX 1003.1 2001 Standard for Microsoft's Win32 environment. Some functions from other sections of POSIX @@ -54,8 +49,8 @@ As much as possible, the ChangeLog file acknowledges contributions to the code base in more detail. -Changes since the last snapshot -------------------------------- +Changes since the last release +------------------------------ These are now documented in the NEWS file. See the ChangeLog file also. diff --git a/BUGS b/BUGS index 12b6abb..d7db951 100644 --- a/BUGS +++ b/BUGS @@ -25,16 +25,17 @@ Known bugs 2. Cancellation problems in optimised code - Milan Gardian + This is suspected to be a compiler bug in VC6.0, and also seen in + VC7.0 and VS .NET 2003. The GNU C++ compiler does not have a problem + with this test, and it has been reported that the Intel C++ 8.1 compiler + and Visual C++ 2005 Express Edition Beta2 are also ok with this test. + Workaround [rpj - 2 Feb 2002] ----------------------------- [Please note: this workaround did not solve a similar problem in snapshot-2004-11-03 or later, even though similar symptoms were seen. tests\semaphore4.c fails in that snapshot for the VCE version of the - DLL. It is suspected to be a compiler bug in VC6.0, and also seen in - VC7.0 and VS .NET 2003. The GNU C++ compiler does not have a problem - with this test, and it has been reported (2005-03-05/08) that the Intel - C++ 8.1 compiler and Visual C++ 2005 Express Edition Beta2 are also - ok with this test.] + DLL.] The problem disappears when /Ob0 is used, i.e. /O2 /Ob0 works OK, but if you want to use inlining optimisation you can be much more diff --git a/CONTRIBUTORS b/CONTRIBUTORS index c23ce98..23adbc7 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,119 +1,121 @@ -Contributors (in approximate order of appearance) +Contributors (in approximate order of appearance) -[See also the ChangeLog file where individuals are -attributed in log entries. Likewise in the FAQ file.] +[See also the ChangeLog file where individuals are +attributed in log entries. Likewise in the FAQ file.] -Ben Elliston bje at cygnus dot com - Initiated the project; - setup the project infrastructure (CVS, web page, etc.); - early prototype routines. -Ross Johnson rpj at callisto dot canberra dot edu dot au - early prototype routines; - ongoing project coordination/maintenance; - implementation of spin locks and barriers; - bug fixes; - documentation; - testsuite. -Robert Colquhoun rjc at trump dot net dot au - Early bug fixes. -John E. Bossom John dot Bossom at cognos dot com - Contributed substantial original working implementation; - bug fixes; - ongoing guidance and standards interpretation. -Anders Norlander anorland at hem2 dot passagen dot se - Early enhancements and runtime checking for supported - Win32 routines. -Tor Lillqvist tml at iki dot fi - General enhancements; - early bug fixes to condition variables. -Scott Lightner scott at curriculum dot com - Bug fix. -Kevin Ruland Kevin dot Ruland at anheuser-busch dot com - Various bug fixes. -Mike Russo miker at eai dot com - Bug fix. -Mark E. Armstrong avail at pacbell dot net - Bug fixes. -Lorin Hochstein lmh at xiphos dot ca - general bug fixes; bug fixes to condition variables. -Peter Slacik Peter dot Slacik at tatramed dot sk - Bug fixes. -Mumit Khan khan at xraylith dot wisc dot edu - Fixes to work with Mingw32. -Milan Gardian mg at tatramed dot sk - Bug fixes and reports/analyses of obscure problems. -Aurelio Medina aureliom at crt dot com - First implementation of read-write locks. -Graham Dumpleton Graham dot Dumpleton at ra dot pad dot otc dot telstra dot com dot au - Bug fix in condition variables. -Tristan Savatier tristan at mpegtv dot com - WinCE port. -Erik Hensema erik at hensema dot xs4all dot nl - Bug fixes. -Rich Peters rpeters at micro-magic dot com -Todd Owen towen at lucidcalm dot dropbear dot id dot au - Bug fixes to dll loading. -Jason Nye jnye at nbnet dot nb dot ca - Implementation of async cancelation. -Fred Forester fforest at eticomm dot net -Kevin D. Clark kclark at cabletron dot com -David Baggett dmb at itasoftware dot com - Bug fixes. -Paul Redondo paul at matchvision dot com -Scott McCaskill scott at 3dfx dot com - Bug fixes. -Jef Gearhart jgearhart at tpssys dot com - Bug fix. -Arthur Kantor akantor at bexusa dot com - Mutex enhancements. -Steven Reddie smr at essemer dot com dot au - Bug fix. -Alexander Terekhov TEREKHOV at de dot ibm dot com - Re-implemented and improved read-write locks; - (with Louis Thomas) re-implemented and improved - condition variables; - enhancements to semaphores; - enhancements to mutexes; - new mutex implementation in 'futex' style; - system clock change handling re CV timeouts; - bug fixes. -Thomas Pfaff tpfaff at gmx dot net - Changes to make C version usable with C++ applications; - re-implemented mutex routines to avoid Win32 mutexes - and TryEnterCriticalSection; - procedure to fix Mingw32 thread-safety issues. -Franco Bez franco dot bez at gmx dot de - procedure to fix Mingw32 thread-safety issues. -Louis Thomas lthomas at arbitrade dot com - (with Alexander Terekhov) re-implemented and improved - condition variables. -David Korn dgk at research dot att dot com - Ported to UWIN. -Phil Frisbie, Jr. phil at hawksoft dot com - Bug fix. -Ralf Brese Ralf dot Brese at pdb4 dot siemens dot de - Bug fix. -prionx at juno dot com prionx at juno dot com - Bug fixes. -Max Woodbury mtew at cds dot duke dot edu - POSIX versioning conditionals; - reduced namespace pollution; - idea to separate routines to reduce statically - linked image sizes. -Rob Fanner rfanner at stonethree dot com - Bug fix. -Michael Johnson michaelj at maine dot rr dot com - Bug fix. -Nicolas Barry boozai at yahoo dot com - Bug fixes. -Piet van Bruggen pietvb at newbridges dot nl - Bug fix. -Makoto Kato raven at oldskool dot jp - AMD64 port. -Panagiotis E. Hadjidoukas peh at hpclab dot ceid dot upatras dot gr - Contributed the QueueUserAPCEx package which - makes preemptive async cancelation possible. -Will Bryant will dot bryant at ecosm dot com - Borland compiler patch and makefile. -Anuj Goyal anuj dot goyal at gmail dot com - Port to Digital Mars compiler. +Ben Elliston bje at cygnus dot com + Initiated the project; + setup the project infrastructure (CVS, web page, etc.); + early prototype routines. +Ross Johnson rpj at callisto dot canberra dot edu dot au + early prototype routines; + ongoing project coordination/maintenance; + implementation of spin locks and barriers; + re-implemented pthread_once (version 1); + various enhancements; + bug fixes; + documentation; + testsuite. +Robert Colquhoun rjc at trump dot net dot au + Early bug fixes. +John E. Bossom John dot Bossom at cognos dot com + Contributed substantial original working implementation; + bug fixes; + ongoing guidance and standards interpretation. +Anders Norlander anorland at hem2 dot passagen dot se + Early enhancements and runtime checking for supported + Win32 routines. +Tor Lillqvist tml at iki dot fi + General enhancements; + early bug fixes to condition variables. +Scott Lightner scott at curriculum dot com + Bug fix. +Kevin Ruland Kevin dot Ruland at anheuser-busch dot com + Various bug fixes. +Mike Russo miker at eai dot com + Bug fix. +Mark E. Armstrong avail at pacbell dot net + Bug fixes. +Lorin Hochstein lmh at xiphos dot ca + general bug fixes; bug fixes to condition variables. +Peter Slacik Peter dot Slacik at tatramed dot sk + Bug fixes. +Mumit Khan khan at xraylith dot wisc dot edu + Fixes to work with Mingw32. +Milan Gardian mg at tatramed dot sk + Bug fixes and reports/analyses of obscure problems. +Aurelio Medina aureliom at crt dot com + First implementation of read-write locks. +Graham Dumpleton Graham dot Dumpleton at ra dot pad dot otc dot telstra dot com dot au + Bug fix in condition variables. +Tristan Savatier tristan at mpegtv dot com + WinCE port. +Erik Hensema erik at hensema dot xs4all dot nl + Bug fixes. +Rich Peters rpeters at micro-magic dot com +Todd Owen towen at lucidcalm dot dropbear dot id dot au + Bug fixes to dll loading. +Jason Nye jnye at nbnet dot nb dot ca + Implementation of async cancelation. +Fred Forester fforest at eticomm dot net +Kevin D. Clark kclark at cabletron dot com +David Baggett dmb at itasoftware dot com + Bug fixes. +Paul Redondo paul at matchvision dot com +Scott McCaskill scott at 3dfx dot com + Bug fixes. +Jef Gearhart jgearhart at tpssys dot com + Bug fix. +Arthur Kantor akantor at bexusa dot com + Mutex enhancements. +Steven Reddie smr at essemer dot com dot au + Bug fix. +Alexander Terekhov TEREKHOV at de dot ibm dot com + Re-implemented and improved read-write locks; + (with Louis Thomas) re-implemented and improved + condition variables; + enhancements to semaphores; + enhancements to mutexes; + new mutex implementation in 'futex' style; + system clock change handling re CV timeouts; + bug fixes. +Thomas Pfaff tpfaff at gmx dot net + Changes to make C version usable with C++ applications; + re-implemented mutex routines to avoid Win32 mutexes + and TryEnterCriticalSection; + procedure to fix Mingw32 thread-safety issues. +Franco Bez franco dot bez at gmx dot de + procedure to fix Mingw32 thread-safety issues. +Louis Thomas lthomas at arbitrade dot com + (with Alexander Terekhov) re-implemented and improved + condition variables. +David Korn dgk at research dot att dot com + Ported to UWIN. +Phil Frisbie, Jr. phil at hawksoft dot com + Bug fix. +Ralf Brese Ralf dot Brese at pdb4 dot siemens dot de + Bug fix. +prionx at juno dot com prionx at juno dot com + Bug fixes. +Max Woodbury mtew at cds dot duke dot edu + POSIX versioning conditionals; + reduced namespace pollution; + idea to separate routines to reduce statically + linked image sizes. +Rob Fanner rfanner at stonethree dot com + Bug fix. +Michael Johnson michaelj at maine dot rr dot com + Bug fix. +Nicolas Barry boozai at yahoo dot com + Bug fixes. +Piet van Bruggen pietvb at newbridges dot nl + Bug fix. +Makoto Kato raven at oldskool dot jp + AMD64 port. +Panagiotis E. Hadjidoukas peh at hpclab dot ceid dot upatras dot gr + Contributed the QueueUserAPCEx package which + makes preemptive async cancelation possible. +Will Bryant will dot bryant at ecosm dot com + Borland compiler patch and makefile. +Anuj Goyal anuj dot goyal at gmail dot com + Port to Digital Mars compiler. diff --git a/ChangeLog b/ChangeLog index a9dc13d..08945d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,30 +1,39 @@ -2005-03-14 Ross Johnson +2005-03-16 Ross Johnson - * CVS (snapshot-2005-03-08-fixes): Created branch for - back-porting fixes to snapshot 2005-03-08. - - * pthread_once.c (pthread_once): Add cancellability to the - init_routine; remove cancellability elsewhere (by disabling - cancellability around pthread_cond_wait in particular); - the meaning of the 'done' flag is changed but the ABI doesn't - change as a result. + * pthread_once.c (pthread_once): Fix faulty 'done' check; fix a + few races involving 'done' flag setting; fix incorrect 'done' + assignment. - * pthread.h (PTHREAD_ONCE_INIT): Change the 'done' flag value - representation (does not change the value - still zero (0)). + * pthread_setcancelstate.c: Don't check for an async cancel event + if the library is using alertable async cancel.. - * implement.h (PTW32_ONCE_CLEAR): Defined. - (PTW32_ONCE_DONE): Defined. - (PTW32_ONCE_CANCELLED): Defined. +2005-03-14 Ross Johnson + + * CVS (snapshot-2005-03-08-fixes): Created branch for + back-porting fixes to snapshot 2005-03-08. + + * pthread_once.c (pthread_once): Add cancellability to the + init_routine; remove cancellability elsewhere (by disabling + cancellability around pthread_cond_wait in particular); + the meaning of the 'done' flag is changed but the ABI doesn't + change as a result. + + * pthread.h (PTHREAD_ONCE_INIT): Change the 'done' flag value + representation (does not change the value - still zero (0)). + + * implement.h (PTW32_ONCE_CLEAR): Defined. + (PTW32_ONCE_DONE): Defined. + (PTW32_ONCE_CANCELLED): Defined. 2005-03-08 Ross Johnson - * pthread_once.c (pthread_once): Redesigned to elliminate potential - starvation problem. - - reported by Gottlob Frege + * pthread_once.c (pthread_once): Redesigned to elliminate potential + starvation problem. + - reported by Gottlob Frege - * ptw32_threadDestroy.c (ptw32_threadDestroy): Implicit threads were - not closing their Win32 thread duplicate handle. - - reported by Dmitrii Semii + * ptw32_threadDestroy.c (ptw32_threadDestroy): Implicit threads were + not closing their Win32 thread duplicate handle. + - reported by Dmitrii Semii 2005-01-25 Ralf Kubis diff --git a/NEWS b/NEWS index 434f37e..d47d99b 100644 --- a/NEWS +++ b/NEWS @@ -1,25 +1,65 @@ +RELEASE 1.4.0 +------------- +(2005-03-16) + +General +------- + +Version 2.0.0 is being released and version 1.4.0 back-ports the +functionality included in that release. In future, bug fixes +will be back-ported if possible and where appropriate, however, +this will be at the maintainer's descretion. New features will +not generally be back-ported, although some may if they +provide major improvements in compatibility with the standard. + +This is intended as a courtesy to application developers, but as +time moves on, the imperative will fade. + +The package naming has changed, replacing the snapshot date with +the version number + descriptive information. E.g. this +release is "pthreads-w32-1-4-0-release". + +Bugs fixed +---------- + +* pthread_setcancelstate() no longer checks for a pending +async cancel event if the library is using alertable async +cancel. See the README file (Prerequisites section) for info +on adding alertable async cancelation. + +New features +------------ + +* pthread_once() now supports init_routine cancellability. + +New tests +--------- + +* Agressively test pthread_once() init_routine cancellability. + + SNAPSHOT 2005-03-08 ------------------- -Version 1.3.0 +Version 1.3.0 Bug reports (fixed) ------------------- -* Implicitly created threads leave Win32 handles behind after exiting. -- Dmitrii Semii +* Implicitly created threads leave Win32 handles behind after exiting. +- Dmitrii Semii -* pthread_once() starvation problem. -- Gottlob Frege +* pthread_once() starvation problem. +- Gottlob Frege -New tests ---------- +New tests +--------- -* More intense testing of pthread_once(). +* More intense testing of pthread_once(). SNAPSHOT 2005-01-25 ------------------- -Version 1.2.0 +Version 1.2.0 Bug fixes --------- @@ -33,7 +73,7 @@ to not be woken when the mutex was released. SNAPSHOT 2005-01-03 ------------------- -Version 1.1.0 +Version 1.1.0 Bug fixes --------- @@ -46,7 +86,7 @@ snapshot-2004-11-03). SNAPSHOT 2004-11-22 ------------------- -Version 1.0.0 +Version 1.0.0 This snapshot primarily fixes the condvar bug introduced in snapshot-2004-11-03. DLL versioning has also been included to allow diff --git a/global.c b/global.c index 59cb56f..8c92a18 100644 --- a/global.c +++ b/global.c @@ -108,9 +108,13 @@ CRITICAL_SECTION ptw32_spinlock_test_init_lock; CRITICAL_SECTION ptw32_cond_list_lock; /* - * Global lock to serialise once_control event management. + * Global condition variable and mutex for once_control management. */ -CRITICAL_SECTION ptw32_once_event_lock; +ptw32_once_control_t ptw32_once_control = + { + PTHREAD_COND_INITIALIZER, + PTHREAD_MUTEX_INITIALIZER + }; #ifdef _UWIN /* diff --git a/pthread_setcancelstate.c b/pthread_setcancelstate.c index 002cfe5..12fdda4 100644 --- a/pthread_setcancelstate.c +++ b/pthread_setcancelstate.c @@ -103,8 +103,10 @@ pthread_setcancelstate (int state, int *oldstate) /* * Check if there is a pending asynchronous cancel + * only if we don't have alertable async cancel. */ if (state == PTHREAD_CANCEL_ENABLE + && (ptw32_features & PTW32_ALERTABLE_ASYNC_CANCEL) == 0 && sp->cancelType == PTHREAD_CANCEL_ASYNCHRONOUS && WaitForSingleObject (sp->cancelEvent, 0) == WAIT_OBJECT_0) { diff --git a/pthread_win32_attach_detach_np.c b/pthread_win32_attach_detach_np.c index 82268ec..6947080 100644 --- a/pthread_win32_attach_detach_np.c +++ b/pthread_win32_attach_detach_np.c @@ -34,7 +34,6 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -//#include "../QueueUserAPCEx/User/QueueUserAPCEx.h" #include "pthread.h" #include "implement.h" diff --git a/tests/ChangeLog b/tests/ChangeLog index 321adc3..edf7ded 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,10 +1,11 @@ -2005-03-12 Ross Johnson +2005-03-16 Ross Johnson + * mutex5.c: Prevent optimiser from removing asserts. * once3.c: New test. -2005-03-08 Ross Johnson +2005-03-08 Ross Johnson - * once2.c: New test. + * once2.c: New test. 2004-11-19 Ross Johnson diff --git a/tests/mutex5.c b/tests/mutex5.c index a597892..a71f9d8 100644 --- a/tests/mutex5.c +++ b/tests/mutex5.c @@ -41,19 +41,23 @@ static pthread_mutexattr_t mxAttr; +/* Prevent optimiser from removing dead or obvious asserts. */ +int _optimiseFoil; +#define FOIL(x) (_optimiseFoil = x) + int main() { int mxType = -1; - assert(PTHREAD_MUTEX_DEFAULT == PTHREAD_MUTEX_NORMAL); - assert(PTHREAD_MUTEX_DEFAULT != PTHREAD_MUTEX_ERRORCHECK); - assert(PTHREAD_MUTEX_DEFAULT != PTHREAD_MUTEX_RECURSIVE); - assert(PTHREAD_MUTEX_RECURSIVE != PTHREAD_MUTEX_ERRORCHECK); + assert(FOIL(PTHREAD_MUTEX_DEFAULT) == PTHREAD_MUTEX_NORMAL); + assert(FOIL(PTHREAD_MUTEX_DEFAULT) != PTHREAD_MUTEX_ERRORCHECK); + assert(FOIL(PTHREAD_MUTEX_DEFAULT) != PTHREAD_MUTEX_RECURSIVE); + assert(FOIL(PTHREAD_MUTEX_RECURSIVE) != PTHREAD_MUTEX_ERRORCHECK); - assert(PTHREAD_MUTEX_NORMAL == PTHREAD_MUTEX_FAST_NP); - assert(PTHREAD_MUTEX_RECURSIVE == PTHREAD_MUTEX_RECURSIVE_NP); - assert(PTHREAD_MUTEX_ERRORCHECK == PTHREAD_MUTEX_ERRORCHECK_NP); + assert(FOIL(PTHREAD_MUTEX_NORMAL) == PTHREAD_MUTEX_FAST_NP); + assert(FOIL(PTHREAD_MUTEX_RECURSIVE) == PTHREAD_MUTEX_RECURSIVE_NP); + assert(FOIL(PTHREAD_MUTEX_ERRORCHECK) == PTHREAD_MUTEX_ERRORCHECK_NP); assert(pthread_mutexattr_init(&mxAttr) == 0); assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); diff --git a/tests/test.h b/tests/test.h index a664bb6..11498cd 100644 --- a/tests/test.h +++ b/tests/test.h @@ -109,8 +109,13 @@ char * error_string[] = { # define ASSERT_TRACE 1 #endif +/* + * Trick to force the compiler to not optimise out dead or obvious expressions. + */ +int ptw32_assert_force = 1; + # define assert(e) \ - ((e) ? ((ASSERT_TRACE) ? fprintf(stderr, \ + (ptw32_assert_force && (e) ? ((ASSERT_TRACE) ? fprintf(stderr, \ "Assertion succeeded: (%s), file %s, line %d\n", \ #e, __FILE__, (int) __LINE__), \ fflush(stderr) : \ @@ -120,7 +125,7 @@ char * error_string[] = { int assertE; # define assert_e(e, o, r) \ - (((assertE = e) o (r)) ? ((ASSERT_TRACE) ? fprintf(stderr, \ + (ptw32_assert_force && ((assertE = e) o (r)) ? ((ASSERT_TRACE) ? fprintf(stderr, \ "Assertion succeeded: (%s), file %s, line %d\n", \ #e, __FILE__, (int) __LINE__), \ fflush(stderr) : \ -- cgit v1.2.3