1RELEASE 2.9.0 2------------- 3(2012-05-25) 4 5General 6------- 7New bug fixes in this release since 2.8.0 have NOT been applied to the 81.x.x series. 9 10Some changes post 2011-02-26 in CVS may not be compatible with pre 11Windows 2000 systems. 12 13Use of other than the "C" version of the library is now discouraged. 14That is, the "C++" version fails some tests and does not provide any 15additional functionality. 16 17Testing and verification 18------------------------ 19This version has been tested on SMP architecture (Intel x64 Hex Core) 20by completing the included test suite, stress and bench tests. 21 22New Features 23------------ 24DLL properties now properly includes the target architecture, i.e. 25right-click on the file pthreadVC2.dll in explorer and choose the Detail 26tab will show the compiler and architecture in the description field, e.g. 27"MS C x64" or "MS C x86". 28- Ross Johnson 29 30(MSC and GNU builds) The statically linked library now automatically 31initialises and cleans up on program start/exit, i.e. statically linked 32applications need not call the routines pthread_win32_process_attach_np() 33and pthread_win32_process_detach_np() explicitly. The per-thread routine 34pthread_win32_thread_detach_np() is also called at program exit to cleanup 35POSIX resources acquired by the primary Windows native thread, if I (RJ) 36understand the process correctly. Other Windows native threads that call 37POSIX API routines may need to call the thread detach routine on thread 38exit if the application depends on reclaimed POSIX resources or running 39POSIX TSD (TLS) destructors. 40See README.NONPORTABLE for descriptions of these routines. 41- Ramiro Polla 42 43Robust mutexes are implemented within the PROCESS_PRIVATE scope. NOTE that 44pthread_mutex_* functions may return different error codes for robust 45mutexes than they otherwise do in normal usage, e.g. pthread_mutex_unlock 46is required to check ownership for all mutex types when the mutex is 47robust, whereas this does not occur for the "normal" non-robust mutex type. 48- Ross Johnson 49 50pthread_getunique_np is implemented for source level compatibility 51with some other implementations. This routine returns a 64 bit 52sequence number that is uniquely associated with a thread. It can be 53used by applications to order or hash POSIX thread handles. 54- Ross Johnson 55 56Bug fixes 57--------- 58Many more changes for 64 bit systems. 59- Kai Tietz 60 61Various modifications and fixes to build and test for WinCE. 62- Marcel Ruff, Sinan Kaya 63 64Fix pthread_cond_destroy() - should not be a cancellation point. Other 65minor build problems fixed. 66- Romano Paolo Tenca 67 68Remove potential deadlock condition from pthread_cond_destroy(). 69- Eric Berge 70 71Various modifications to build and test for Win64. 72- Kip Streithorst 73 74Various fixes to the QueueUserAPCEx async cancellation helper DLL 75(this is a separate download) and pthreads code cleanups. 76- Sebastian Gottschalk 77 78Removed potential NULL pointer reference. 79- Robert Kindred 80 81Removed the requirement that applications restrict the number of threads 82calling pthread_barrier_wait to just the barrier count. Also reduced the 83contention between barrier_wait and barrier_destroy. This change will have 84slowed barriers down slightly but halves the number of semaphores consumed 85per barrier to one. 86- Ross Johnson 87 88Fixed a handle leak in sched_[gs]etscheduler. 89- Mark Pizzolato 90 91Removed all of the POSIX re-entrant function compatibility macros from pthread.h. 92Some were simply not semanticly correct. 93- Igor Lubashev 94 95Threads no longer attempt to pass uncaught exceptions out of thread scope (C++ 96and SEH builds only). Uncaught exceptions now cause the thread to exit with 97the return code PTHREAD_CANCELED. 98- Ross Johnson 99 100Lots of casting fixes particularly for x64, Interlocked fixes and reworking 101for x64. 102- Daniel Richard G., John Kamp 103 104Other changes 105------------- 106Dependence on the winsock library is now discretionary via 107#define RETAIN_WSALASTERROR in config.h. It is undefined by default unless 108WINCE is defined (because RJ is unsure of the dependency there). 109- Ramiro Polla 110 111Several static POSIX mutexes used for internal management were replaced by 112MCS queue-based locks to reduce resource consumption, in particular use of Win32 113objects. 114- Ross Johnson 115 116For security, the QuserEx.dll if used must now be installed in the Windows System 117folder. 118- Ross Johnson 119 120New tests 121--------- 122robust[1-5].c - Robust mutexes 123sequence1.c - per-thread unique sequence numbers 124 125Modified tests and benchtests 126----------------------------- 127All mutex*.c tests wherever appropriate have been modified to also test 128robust mutexes under the same conditions. 129Added robust mutex benchtests to benchtest*.c wherever appropriate. 130 131 132RELEASE 2.8.0 133------------- 134(2006-12-22) 135 136General 137------- 138New bug fixes in this release since 2.7.0 have not been applied to the 139version 1.x.x series. It is probably time to drop version 1. 140 141Testing and verification 142------------------------ 143This release has not yet been tested on SMP architechtures. All tests pass 144on a uni-processor system. 145 146Bug fixes 147--------- 148Sem_destroy could return EBUSY even though no threads were waiting on the 149semaphore. Other races around invalidating semaphore structs (internally) 150have been removed as well. 151 152New tests 153--------- 154semaphore5.c - tests the bug fix referred to above. 155 156 157RELEASE 2.7.0 158------------- 159(2005-06-04) 160 161General 162------- 163All new features in this release have been back-ported in release 1.11.0, 164including the incorporation of MCS locks in pthread_once, however, versions 1651 and 2 remain incompatible even though they are now identical in 166performance and functionality. 167 168Testing and verification 169------------------------ 170This release has been tested (passed the test suite) on both uni-processor 171and multi-processor systems. 172- Tim Theisen 173 174Bug fixes 175--------- 176Pthread_once has been re-implemented to remove priority boosting and other 177complexity to improve robustness. Races for Win32 handles that are not 178recycle-unique have been removed. The general form of pthread_once is now 179the same as that suggested earlier by Alexander Terekhov, but instead of the 180'named mutex', a queue-based lock has been implemented which has the required 181properties of dynamic self initialisation and destruction. This lock is also 182efficient. The ABI is unaffected in as much as the size of pthread_once_t has 183not changed and PTHREAD_ONCE_INIT has not changed, however, applications that 184peek inside pthread_once_t, which is supposed to be opaque, will break. 185- Vladimir Kliatchko 186 187New features 188------------ 189* Support for Mingw cross development tools added to GNUmakefile. 190Mingw cross tools allow building the libraries on Linux. 191- Mikael Magnusson 192 193 194RELEASE 2.6.0 195------------- 196(2005-05-19) 197 198General 199------- 200All of the bug fixes and new features in this release have been 201back-ported in release 1.10.0. 202 203Testing and verification 204------------------------ 205This release has been tested (passed the test suite) on both uni-processor 206and multi-processor systems. Thanks to Tim Theisen at TomoTherapy for 207exhaustively running the MP tests and for providing crutial observations 208and data when faults are detected. 209 210Bugs fixed 211---------- 212 213* pthread_detach() now reclaims remaining thread resources if called after 214the target thread has terminated. Previously, this routine did nothing in 215this case. 216 217New tests 218--------- 219 220* detach1.c - tests that pthread_detach properly invalidates the target 221thread, which indicates that the thread resources have been reclaimed. 222 223 224RELEASE 2.5.0 225------------- 226(2005-05-09) 227 228General 229------- 230 231The package now includes a reference documentation set consisting of 232HTML formatted Unix-style manual pages that have been edited for 233consistency with Pthreads-w32. The set can also be read online at: 234http://sources.redhat.com/pthreads-win32/manual/index.html 235 236Thanks again to Tim Theisen for running the test suite pre-release 237on an MP system. 238 239All of the bug fixes and new features in this release have been 240back-ported in release 1.9.0. 241 242Bugs fixed 243---------- 244 245* Thread Specific Data (TSD) key management has been ammended to 246eliminate a source of (what was effectively) resource leakage (a HANDLE 247plus memory for each key destruct routine/thread association). This was 248not a true leak because these resources were eventually reclaimed when 249pthread_key_delete was run AND each thread referencing the key had exited. 250The problem was that these two conditions are often not met until very 251late, and often not until the process is about to exit. 252 253The ammended implementation avoids the need for the problematic HANDLE 254and reclaims the memory as soon as either the key is deleted OR the 255thread exits, whichever is first. 256 257Thanks to Richard Hughes at Aculab for identifying and locating the leak. 258 259* TSD key destructors are now processed up to PTHREAD_DESTRUCTOR_ITERATIONS 260times instead of just once. PTHREAD_DESTRUCTOR_ITERATIONS has been 261defined in pthread.h for some time but not used. 262 263* Fix a semaphore accounting race between sem_post/sem_post_multiple 264and sem_wait cancellation. This is the same issue as with 265sem_timedwait that was fixed in the last release. 266 267* sem_init, sem_post, and sem_post_multiple now check that the 268semaphore count never exceeds _POSIX_SEM_VALUE_MAX. 269 270* Although sigwait() is nothing more than a no-op, it should at least 271be a cancellation point to be consistent with the standard. 272 273New tests 274--------- 275 276* stress1.c - attempts to expose problems in condition variable 277and semaphore timed wait logic. This test was inspired by Stephan 278Mueller's sample test code used to identify the sem_timedwait bug 279from the last release. It's not a part of the regular test suite 280because it can take awhile to run. To run it: 281nmake clean VC-stress 282 283* tsd2.c - tests that key destructors are re-run if the tsd key value is 284not NULL after the destructor routine has run. Also tests that 285pthread_setspecific() and pthread_getspecific() are callable from 286destructors. 287 288 289RELEASE 2.4.0 290------------- 291(2005-04-26) 292 293General 294------- 295 296There is now no plan to release a version 3.0.0 to fix problems in 297pthread_once(). Other possible implementations of pthread_once 298will still be investigated for a possible future release in an attempt 299to reduce the current implementation's complexity. 300 301All of the bug fixes and new features in this release have been 302back-ported for release 1.8.0. 303 304Bugs fixed 305---------- 306 307* Fixed pthread_once race (failures on an MP system). Thanks to 308Tim Theisen for running exhaustive pre-release testing on his MP system 309using a range of compilers: 310 VC++ 6 311 VC++ 7.1 312 Intel C++ version 8.0 313All tests passed. 314Some minor speed improvements were also done. 315 316* Fix integer overrun error in pthread_mutex_timedlock() - missed when 317sem_timedwait() was fixed in release 2.2.0. This routine no longer returns 318ENOTSUP when NEED_SEM is defined - it is supported (NEED_SEM is only 319required for WinCE versions prior to 3.0). 320 321* Fix timeout bug in sem_timedwait(). 322- Thanks to Stephan Mueller for reporting, providing diagnostic output 323and test code. 324 325* Fix several problems in the NEED_SEM conditionally included code. 326NEED_SEM included code is provided for systems that don't implement W32 327semaphores, such as WinCE prior to version 3.0. An alternate implementation 328of POSIX semaphores is built using W32 events for these systems when 329NEED_SEM is defined. This code has been completely rewritten in this 330release to reuse most of the default POSIX semaphore code, and particularly, 331to implement all of the sem_* routines supported by pthreads-win32. Tim 332Theisen also run the test suite over the NEED_SEM code on his MP system. All 333tests passed. 334 335* The library now builds without errors for the Borland Builder 5.5 compiler. 336 337New features 338------------ 339 340* pthread_mutex_timedlock() and all sem_* routines provided by 341pthreads-win32 are now implemented for WinCE versions prior to 3.0. Those 342versions did not implement W32 semaphores. Define NEED_SEM in config.h when 343building the library for these systems. 344 345Known issues in this release 346---------------------------- 347 348* pthread_once is too complicated - but it works as far as testing can 349determine.. 350 351* The Borland version of the dll fails some of the tests with a memory read 352exception. The cause is not yet known but a compiler bug has not been ruled 353out. 354 355 356RELEASE 2.3.0 357------------- 358(2005-04-12) 359 360General 361------- 362 363Release 1.7.0 is a backport of features and bug fixes new in 364this release. See earlier notes under Release 2.0.0/General. 365 366Bugs fixed 367---------- 368 369* Fixed pthread_once potential for post once_routine cancellation 370hanging due to starvation. See comments in pthread_once.c. 371Momentary priority boosting is used to ensure that, after a 372once_routine is cancelled, the thread that will run the 373once_routine is not starved by higher priority waiting threads at 374critical times. Priority boosting occurs only AFTER a once_routine 375cancellation, and is applied only to that once_control. The 376once_routine is run at the thread's normal base priority. 377 378New tests 379--------- 380 381* once4.c: Aggressively tests pthread_once() under realtime 382conditions using threads with varying priorities. Windows' 383random priority boosting does not occur for threads with realtime 384priority levels. 385 386 387RELEASE 2.2.0 388------------- 389(2005-04-04) 390 391General 392------- 393 394* Added makefile targets to build static link versions of the library. 395Both MinGW and MSVC. Please note that this does not imply any change 396to the LGPL licensing, which still imposes psecific conditions on 397distributing software that has been statically linked with this library. 398 399* There is a known bug in pthread_once(). Cancellation of the init_routine 400exposes a potential starvation (i.e. deadlock) problem if a waiting thread 401has a higher priority than the initting thread. This problem will be fixed 402in version 3.0.0 of the library. 403 404Bugs fixed 405---------- 406 407* Fix integer overrun error in sem_timedwait(). 408Kevin Lussier 409 410* Fix preprocessor directives for static linking. 411Dimitar Panayotov 412 413 414RELEASE 2.1.0 415------------- 416(2005-03-16) 417 418Bugs fixed 419---------- 420 421* Reverse change to pthread_setcancelstate() in 2.0.0. 422 423 424RELEASE 2.0.0 425------------- 426(2005-03-16) 427 428General 429------- 430 431This release represents an ABI change and the DLL version naming has 432incremented from 1 to 2, e.g. pthreadVC2.dll. 433 434Version 1.4.0 back-ports the new functionality included in this 435release. Please distribute DLLs built from that version with updates 436to applications built on pthreads-win32 version 1.x.x. 437 438The package naming has changed, replacing the snapshot date with 439the version number + descriptive information. E.g. this 440release is "pthreads-w32-2-0-0-release". 441 442Bugs fixed 443---------- 444 445* pthread_setcancelstate() no longer checks for a pending 446async cancel event if the library is using alertable async 447cancel. See the README file (Prerequisites section) for info 448on adding alertable async cancelation. 449 450New features 451------------ 452 453* pthread_once() now supports init_routine cancellability. 454 455New tests 456--------- 457 458* Agressively test pthread_once() init_routine cancellability. 459 460 461SNAPSHOT 2005-03-08 462------------------- 463Version 1.3.0 464 465Bug reports (fixed) 466------------------- 467 468* Implicitly created threads leave Win32 handles behind after exiting. 469- Dmitrii Semii 470 471* pthread_once() starvation problem. 472- Gottlob Frege 473 474New tests 475--------- 476 477* More intense testing of pthread_once(). 478 479 480SNAPSHOT 2005-01-25 481------------------- 482Version 1.2.0 483 484Bug fixes 485--------- 486 487* Attempted acquisition of a recursive mutex could cause waiting threads 488to not be woken when the mutex was released. 489- Ralf Kubis <RKubis at mc.com> 490 491* Various package omissions have been fixed. 492 493 494SNAPSHOT 2005-01-03 495------------------- 496Version 1.1.0 497 498Bug fixes 499--------- 500 501* Unlocking recursive or errorcheck mutexes would sometimes 502unexpectedly return an EPERM error (bug introduced in 503snapshot-2004-11-03). 504- Konstantin Voronkov <beowinkle at yahoo.com> 505 506 507SNAPSHOT 2004-11-22 508------------------- 509Version 1.0.0 510 511This snapshot primarily fixes the condvar bug introduced in 512snapshot-2004-11-03. DLL versioning has also been included to allow 513applications to runtime check the Microsoft compatible DLL version 514information, and to extend the DLL naming system for ABI and major 515(non-backward compatible) API changes. See the README file for details. 516 517Bug fixes 518--------- 519 520* Condition variables no longer deadlock (bug introduced in 521snapshot-2004-11-03). 522- Alexander Kotliarov and Nicolas at saintmac 523 524* DLL naming extended to avoid 'DLL hell' in the future, and to 525accommodate the ABI change introduced in snapshot-2004-11-03. Snapshot 5262004-11-03 will be removed from FTP sites. 527 528New features 529------------ 530 531* A Microsoft-style version resource has been added to the DLL for 532applications that wish to check DLL compatibility at runtime. 533 534* Pthreads-win32 DLL naming has been extended to allow incompatible DLL 535versions to co-exist in the same filesystem. See the README file for details, 536but briefly: while the version information inside the DLL will change with 537each release from now on, the DLL version names will only change if the new 538DLL is not backward compatible with older applications. 539 540The versioning scheme has been borrowed from GNU Libtool, and the DLL 541naming scheme is from Cygwin. Provided the Libtool-style numbering rules are 542honoured, the Cygwin DLL naming scheme automatcally ensures that DLL name 543changes are minimal and that applications will not load an incompatible 544pthreads-win32 DLL. 545 546Those who use the pre-built DLLs will find that the DLL/LIB names have a new 547suffix (1) in this snapshot. E.g. pthreadVC1.dll etc. 548 549* The POSIX thread ID reuse uniqueness feature introduced in the last snapshot 550has been kept as default, but the behaviour can now be controlled when the DLL 551is built to effectively switch it off. This makes the library much more 552sensitive to applications that assume that POSIX thread IDs are unique, i.e. 553are not strictly compliant with POSIX. See the PTW32_THREAD_ID_REUSE_INCREMENT 554macro comments in config.h for details. 555 556Other changes 557------------- 558Certain POSIX macros have changed. 559 560These changes are intended to conform to the Single Unix Specification version 3, 561which states that, if set to 0 (zero) or not defined, then applications may use 562sysconf() to determine their values at runtime. Pthreads-win32 does not 563implement sysconf(). 564 565The following macros are no longer undefined, but defined and set to -1 566(not implemented): 567 568 _POSIX_THREAD_ATTR_STACKADDR 569 _POSIX_THREAD_PRIO_INHERIT 570 _POSIX_THREAD_PRIO_PROTECT 571 _POSIX_THREAD_PROCESS_SHARED 572 573The following macros are defined and set to 200112L (implemented): 574 575 _POSIX_THREADS 576 _POSIX_THREAD_SAFE_FUNCTIONS 577 _POSIX_THREAD_ATTR_STACKSIZE 578 _POSIX_THREAD_PRIORITY_SCHEDULING 579 _POSIX_SEMAPHORES 580 _POSIX_READER_WRITER_LOCKS 581 _POSIX_SPIN_LOCKS 582 _POSIX_BARRIERS 583 584The following macros are defined and set to appropriate values: 585 586 _POSIX_THREAD_THREADS_MAX 587 _POSIX_SEM_VALUE_MAX 588 _POSIX_SEM_NSEMS_MAX 589 PTHREAD_DESTRUCTOR_ITERATIONS 590 PTHREAD_KEYS_MAX 591 PTHREAD_STACK_MIN 592 PTHREAD_THREADS_MAX 593 594 595SNAPSHOT 2004-11-03 596------------------- 597 598DLLs produced from this snapshot cannot be used with older applications without 599recompiling the application, due to a change to pthread_t to provide unique POSIX 600thread IDs. 601 602Although this snapshot passes the extended test suite, many of the changes are 603fairly major, and some applications may show different behaviour than previously, 604so adopt with care. Hopefully, any changed behaviour will be due to the library 605being better at it's job, not worse. 606 607Bug fixes 608--------- 609 610* pthread_create() no longer accepts NULL as the thread reference arg. 611A segfault (memory access fault) will result, and no thread will be 612created. 613 614* pthread_barrier_wait() no longer acts as a cancelation point. 615 616* Fix potential race condition in pthread_once() 617- Tristan Savatier <tristan at mpegtv.com> 618 619* Changes to pthread_cond_destroy() exposed some coding weaknesses in several 620test suite mini-apps because pthread_cond_destroy() now returns EBUSY if the CV 621is still in use. 622 623New features 624------------ 625 626* Added for compatibility: 627PTHREAD_RECURSIVE_MUTEX_INITIALIZER, 628PTHREAD_ERRORCHECK_MUTEX_INITIALIZER, 629PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, 630PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP 631 632* Initial support for Digital Mars compiler 633- Anuj Goyal <anuj.goyal at gmail.com> 634 635* Faster Mutexes. These have been been rewritten following a model provided by 636Alexander Terekhov that reduces kernel space checks, and eliminates some additional 637critical sections used to manage a race between timedlock expiration and unlock. 638Please be aware that the new mutexes do not enforce strict absolute FIFO scheduling 639of mutexes, however any out-of-order lock acquisition should be very rare. 640 641* Faster semaphores. Following a similar model to mutexes above, these have been 642rewritten to use preliminary users space checks. 643 644* sem_getvalue() now returns the number of waiters. 645 646* The POSIX thread ID now has much stronger uniqueness characteristics. The library 647garrantees not to reuse the same thread ID for at least 2^(wordsize) thread 648destruction/creation cycles. 649 650New tests 651--------- 652 653* semaphore4.c: Tests cancelation of the new sem_wait(). 654 655* semaphore4t.c: Likewise for sem_timedwait(). 656 657* rwlock8.c: Tests and times the slow execution paths of r/w locks, and the CVs, 658mutexes, and semaphores that they're built on. 659 660 661SNAPSHOT 2004-05-16 662------------------- 663 664Attempt to add Watcom to the list of compilers that can build the library. 665This failed in the end due to it's non-thread-aware errno. The library 666builds but the test suite fails. See README.Watcom for more details. 667 668Bug fixes 669--------- 670* Bug and memory leak in sem_init() 671- Alex Blanco <Alex.Blanco at motorola.com> 672 673* ptw32_getprocessors() now returns CPU count of 1 for WinCE. 674- James Ewing <james.ewing at sveasoft.com> 675 676* pthread_cond_wait() could be canceled at a point where it should not 677be cancelable. Fixed. 678- Alexander Terekhov <TEREKHOV at de.ibm.com> 679 680* sem_timedwait() had an incorrect timeout calculation. 681- Philippe Di Cristo <philipped at voicebox.com> 682 683* Fix a memory leak left behind after threads are destroyed. 684- P. van Bruggen <pietvb at newbridges.nl> 685 686New features 687------------ 688* Ported to AMD64. 689- Makoto Kato <raven at oldskool.jp> 690 691* True pre-emptive asynchronous cancelation of threads. This is optional 692and requires that Panagiotis E. Hadjidoukas's QueueUserAPCEx package be 693installed. This package is included in the pthreads-win32 self-unpacking 694Zip archive starting from this snapshot. See the README.txt file inside 695the package for installation details. 696 697Note: If you don't use async cancelation in your application, or don't need 698to cancel threads that are blocked on system resources such as network I/O, 699then the default non-preemptive async cancelation is probably good enough. 700However, pthreads-win32 auto-detects the availability of these components 701at run-time, so you don't need to rebuild the library from source if you 702change your mind later. 703 704All of the advice available in books and elsewhere on the undesirability 705of using async cancelation in any application still stands, but this 706feature is a welcome addition with respect to the library's conformance to 707the POSIX standard. 708 709SNAPSHOT 2003-09-18 710------------------- 711 712Cleanup of thread priority management. In particular, setting of thread 713priority now attempts to map invalid Win32 values within the range returned 714by sched_get_priority_min/max() to useful values. See README.NONPORTABLE 715under "Thread priority". 716 717Bug fixes 718--------- 719* pthread_getschedparam() now returns the priority given by the most recent 720call to pthread_setschedparam() or established by pthread_create(), as 721required by the standard. Previously, pthread_getschedparam() incorrectly 722returned the running thread priority at the time of the call, which may have 723been adjusted or temporarily promoted/demoted. 724 725* sched_get_priority_min() and sched_get_priority_max() now return -1 on error 726and set errno. Previously, they incorrectly returned the error value directly. 727 728 729SNAPSHOT 2003-09-04 730------------------- 731 732Bug fixes 733--------- 734* ptw32_cancelableWait() now allows cancelation of waiting implicit POSIX 735threads. 736 737New test 738-------- 739* cancel8.c tests cancelation of Win32 threads waiting at a POSIX cancelation 740point. 741 742 743SNAPSHOT 2003-09-03 744------------------- 745 746Bug fixes 747--------- 748* pthread_self() would free the newly created implicit POSIX thread handle if 749DuplicateHandle failed instead of recycle it (very unlikely). 750 751* pthread_exit() was neither freeing nor recycling the POSIX thread struct 752for implicit POSIX threads. 753 754New feature - Cancelation of/by Win32 (non-POSIX) threads 755--------------------------------------------------------- 756Since John Bossom's original implementation, the library has allowed non-POSIX 757initialised threads (Win32 threads) to call pthreads-win32 routines and 758therefore interact with POSIX threads. This is done by creating an on-the-fly 759POSIX thread ID for the Win32 thread that, once created, allows fully 760reciprical interaction. This did not extend to thread cancelation (async or 761deferred). Now it does. 762 763Any thread can be canceled by any other thread (Win32 or POSIX) if the former 764thread's POSIX pthread_t value is known. It's TSD destructors and POSIX 765cleanup handlers will be run before the thread exits with an exit code of 766PTHREAD_CANCELED (retrieved with GetExitCodeThread()). 767 768This allows a Win32 thread to, for example, call POSIX CV routines in the same way 769that POSIX threads would/should, with pthread_cond_wait() cancelability and 770cleanup handlers (pthread_cond_wait() is a POSIX cancelation point). 771 772By adding cancelation, Win32 threads should now be able to call all POSIX 773threads routines that make sense including semaphores, mutexes, condition 774variables, read/write locks, barriers, spinlocks, tsd, cleanup push/pop, 775cancelation, pthread_exit, scheduling, etc. 776 777Note that these on-the-fly 'implicit' POSIX thread IDs are initialised as detached 778(not joinable) with deferred cancelation type. The POSIX thread ID will be created 779automatically by any POSIX routines that need a POSIX handle (unless the routine 780needs a pthread_t as a parameter of course). A Win32 thread can discover it's own 781POSIX thread ID by calling pthread_self(), which will create the handle if 782necessary and return the pthread_t value. 783 784New tests 785--------- 786Test the above new feature. 787 788 789SNAPSHOT 2003-08-19 790------------------- 791 792This snapshot fixes some accidental corruption to new test case sources. 793There are no changes to the library source code. 794 795 796SNAPSHOT 2003-08-15 797------------------- 798 799Bug fixes 800--------- 801 802* pthread.dsp now uses correct compile flags (/MD). 803- Viv <vcotirlea@hotmail.com> 804 805* pthread_win32_process_detach_np() fixed memory leak. 806- Steven Reddie <Steven.Reddie@ca.com> 807 808* pthread_mutex_destroy() fixed incorrect return code. 809- Nicolas Barry <boozai@yahoo.com> 810 811* pthread_spin_destroy() fixed memory leak. 812- Piet van Bruggen <pietvb@newbridges.nl> 813 814* Various changes to tighten arg checking, and to work with later versions of 815MinGW32 and MsysDTK. 816 817* pthread_getschedparam() etc, fixed dangerous thread validity checking. 818- Nicolas Barry <boozai@yahoo.com> 819 820* POSIX thread handles are now reused and their memory is not freed on thread exit. 821This allows for stronger thread validity checking. 822 823New standard routine 824-------------------- 825 826* pthread_kill() added to provide thread validity checking to applications. 827It does not accept any non zero values for the signal arg. 828 829New test cases 830-------------- 831 832* New test cases to confirm validity checking, pthread_kill(), and thread reuse. 833 834 835SNAPSHOT 2003-05-10 836------------------- 837 838Bug fixes 839--------- 840 841* pthread_mutex_trylock() now returns correct error values. 842pthread_mutex_destroy() will no longer destroy a recursively locked mutex. 843pthread_mutex_lock() is no longer inadvertantly behaving as a cancelation point. 844- Thomas Pfaff <tpfaff@gmx.net> 845 846* pthread_mutex_timedlock() no longer occasionally sets incorrect mutex 847ownership, causing deadlocks in some applications. 848- Robert Strycek <strycek@posam.sk> and Alexander Terekhov <TEREKHOV@de.ibm.com> 849 850 851SNAPSHOT 2002-11-04 852------------------- 853 854Bug fixes 855--------- 856 857* sem_getvalue() now returns the correct value under Win NT and WinCE. 858- Rob Fanner <rfanner@stonethree.com> 859 860* sem_timedwait() now uses tighter checks for unreasonable 861abstime values - that would result in unexpected timeout values. 862 863* ptw32_cond_wait_cleanup() no longer mysteriously consumes 864CV signals but may produce more spurious wakeups. It is believed 865that the sem_timedwait() call is consuming a CV signal that it 866shouldn't. 867- Alexander Terekhov <TEREKHOV@de.ibm.com> 868 869* Fixed a memory leak in ptw32_threadDestroy() for implicit threads. 870 871* Fixed potential for deadlock in pthread_cond_destroy(). 872A deadlock could occur for statically declared CVs (PTHREAD_COND_INITIALIZER), 873when one thread is attempting to destroy the condition variable while another 874is attempting to dynamically initialize it. 875- Michael Johnson <michaelj@maine.rr.com> 876 877 878SNAPSHOT 2002-03-02 879------------------- 880 881Cleanup code default style. (IMPORTANT) 882---------------------------------------------------------------------- 883Previously, if not defined, the cleanup style was determined automatically 884from the compiler/language, and one of the following was defined accordingly: 885 886 __CLEANUP_SEH MSVC only 887 __CLEANUP_CXX C++, including MSVC++, GNU G++ 888 __CLEANUP_C C, including GNU GCC, not MSVC 889 890These defines determine the style of cleanup (see pthread.h) and, 891most importantly, the way that cancelation and thread exit (via 892pthread_exit) is performed (see the routine ptw32_throw() in private.c). 893 894In short, the exceptions versions of the library throw an exception 895when a thread is canceled or exits (via pthread_exit()), which is 896caught by a handler in the thread startup routine, so that the 897the correct stack unwinding occurs regardless of where the thread 898is when it's canceled or exits via pthread_exit(). 899 900In this and future snapshots, unless the build explicitly defines (e.g. 901via a compiler option) __CLEANUP_SEH, __CLEANUP_CXX, or __CLEANUP_C, then 902the build NOW always defaults to __CLEANUP_C style cleanup. This style 903uses setjmp/longjmp in the cancelation and pthread_exit implementations, 904and therefore won't do stack unwinding even when linked to applications 905that have it (e.g. C++ apps). This is for consistency with most 906current commercial Unix POSIX threads implementations. Compaq's TRU64 907may be an exception (no pun intended) and possible future trend. 908 909Although it was not clearly documented before, it is still necessary to 910build your application using the same __CLEANUP_* define as was 911used for the version of the library that you link with, so that the 912correct parts of pthread.h are included. That is, the possible 913defines require the following library versions: 914 915 __CLEANUP_SEH pthreadVSE.dll 916 __CLEANUP_CXX pthreadVCE.dll or pthreadGCE.dll 917 __CLEANUP_C pthreadVC.dll or pthreadGC.dll 918 919E.g. regardless of whether your app is C or C++, if you link with 920pthreadVC.lib or libpthreadGC.a, then you must define __CLEANUP_C. 921 922 923THE POINT OF ALL THIS IS: if you have not been defining one of these 924explicitly, then the defaults as described at the top of this 925section were being used. 926 927THIS NOW CHANGES, as has been explained above, but to try to make this 928clearer here's an example: 929 930If you were building your application with MSVC++ i.e. using C++ 931exceptions and not explicitly defining one of __CLEANUP_*, then 932__CLEANUP_C++ was automatically defined for you in pthread.h. 933You should have been linking with pthreadVCE.dll, which does 934stack unwinding. 935 936If you now build your application as you had before, pthread.h will now 937automatically set __CLEANUP_C as the default style, and you will need to 938link with pthreadVC.dll. Stack unwinding will now NOT occur when a thread 939is canceled, or the thread calls pthread_exit(). 940 941Your application will now most likely behave differently to previous 942versions, and in non-obvious ways. Most likely is that locally 943instantiated objects may not be destroyed or cleaned up after a thread 944is canceled. 945 946If you want the same behaviour as before, then you must now define 947__CLEANUP_C++ explicitly using a compiler option and link with 948pthreadVCE.dll as you did before. 949 950 951WHY ARE WE MAKING THE DEFAULT STYLE LESS EXCEPTION-FRIENDLY? 952Because no commercial Unix POSIX threads implementation allows you to 953choose to have stack unwinding. Therefore, providing it in pthread-win32 954as a default is dangerous. We still provide the choice but unless 955you consciously choose to do otherwise, your pthreads applications will 956now run or crash in similar ways irrespective of the threads platform 957you use. Or at least this is the hope. 958 959 960WHY NOT REMOVE THE EXCEPTIONS VERSIONS OF THE LIBRARY ALTOGETHER? 961There are a few reasons: 962- because there are well respected POSIX threads people who believe 963 that POSIX threads implementations should be exceptions aware and 964 do the expected thing in that context. (There are equally respected 965 people who believe it should not be easily accessible, if it's there 966 at all, for unconditional conformity to other implementations.) 967- because pthreads-win32 is one of the few implementations that has 968 the choice, perhaps the only freely available one, and so offers 969 a laboratory to people who may want to explore the effects; 970- although the code will always be around somewhere for anyone who 971 wants it, once it's removed from the current version it will not be 972 nearly as visible to people who may have a use for it. 973 974 975Source module splitting 976----------------------- 977In order to enable smaller image sizes to be generated 978for applications that link statically with the library, 979most routines have been separated out into individual 980source code files. 981 982This is being done in such a way as to be backward compatible. 983The old source files are reused to congregate the individual 984routine files into larger translation units (via a bunch of 985# includes) so that the compiler can still optimise wherever 986possible, e.g. through inlining, which can only be done 987within the same translation unit. 988 989It is also possible to build the entire library by compiling 990the single file named "pthread.c", which just #includes all 991the secondary congregation source files. The compiler 992may be able to use this to do more inlining of routines. 993 994Although the GNU compiler is able to produce libraries with 995the necessary separation (the -ffunction-segments switch), 996AFAIK, the MSVC and other compilers don't have this feature. 997 998Finally, since I use makefiles and command-line compilation, 999I don't know what havoc this reorganisation may wreak amongst 1000IDE project file users. You should be able to continue 1001using your existing project files without modification. 1002 1003 1004New non-portable functions 1005-------------------------- 1006pthread_num_processors_np(): 1007 Returns the number of processors in the system that are 1008 available to the process, as determined from the processor 1009 affinity mask. 1010 1011pthread_timechange_handler_np(): 1012 To improve tolerance against operator or time service initiated 1013 system clock changes. 1014 1015 This routine can be called by an application when it 1016 receives a WM_TIMECHANGE message from the system. At present 1017 it broadcasts all condition variables so that waiting threads 1018 can wake up and re-evaluate their conditions and restart 1019 their timed waits if required. 1020 - Suggested by Alexander Terekhov 1021 1022 1023Platform dependence 1024------------------- 1025As Win95 doesn't provide one, the library now contains 1026it's own InterlockedCompareExchange() routine, which is used 1027whenever Windows doesn't provide it. InterlockedCompareExchange() 1028is used to implement spinlocks and barriers, and also in mutexes. 1029This routine relies on the CMPXCHG machine instruction which 1030is not available on i386 CPUs. This library (from snapshot 103120010712 onwards) is therefore no longer supported on i386 1032processor platforms. 1033 1034 1035New standard routines 1036--------------------- 1037For source code portability only - rwlocks cannot be process shared yet. 1038 1039 pthread_rwlockattr_init() 1040 pthread_rwlockattr_destroy() 1041 pthread_rwlockattr_setpshared() 1042 pthread_rwlockattr_getpshared() 1043 1044As defined in the new POSIX standard, and the Single Unix Spec version 3: 1045 1046 sem_timedwait() 1047 pthread_mutex_timedlock() - Alexander Terekhov and Thomas Pfaff 1048 pthread_rwlock_timedrdlock() - adapted from pthread_rwlock_rdlock() 1049 pthread_rwlock_timedwrlock() - adapted from pthread_rwlock_wrlock() 1050 1051 1052pthread.h no longer includes windows.h 1053-------------------------------------- 1054[Not yet for G++] 1055 1056This was done to prevent conflicts. 1057 1058HANDLE, DWORD, and NULL are temporarily defined within pthread.h if 1059they are not already. 1060 1061 1062pthread.h, sched.h and semaphore.h now use dllexport/dllimport 1063-------------------------------------------------------------- 1064Not only to avoid the need for the pthread.def file, but to 1065improve performance. Apparently, declaring functions with dllimport 1066generates a direct call to the function and avoids the overhead 1067of a stub function call. 1068 1069Bug fixes 1070--------- 1071* Fixed potential NULL pointer dereferences in pthread_mutexattr_init, 1072pthread_mutexattr_getpshared, pthread_barrierattr_init, 1073pthread_barrierattr_getpshared, and pthread_condattr_getpshared. 1074- Scott McCaskill <scott@magruder.org> 1075 1076* Removed potential race condition in pthread_mutex_trylock and 1077pthread_mutex_lock; 1078- Alexander Terekhov <TEREKHOV@de.ibm.com> 1079 1080* The behaviour of pthread_mutex_trylock in relation to 1081recursive mutexes was inconsistent with commercial implementations. 1082Trylock would return EBUSY if the lock was owned already by the 1083calling thread regardless of mutex type. Trylock now increments the 1084recursion count and returns 0 for RECURSIVE mutexes, and will 1085return EDEADLK rather than EBUSY for ERRORCHECK mutexes. This is 1086consistent with Solaris. 1087- Thomas Pfaff <tpfaff@gmx.net> 1088 1089* Found a fix for the library and workaround for applications for 1090the known bug #2, i.e. where __CLEANUP_CXX or __CLEANUP_SEH is defined. 1091See the "Known Bugs in this snapshot" section below. 1092 1093This could be made transparent to applications by replacing the macros that 1094define the current C++ and SEH versions of pthread_cleanup_push/pop 1095with the C version, but AFAIK cleanup handlers would not then run in the 1096correct sequence with destructors and exception cleanup handlers when 1097an exception occurs. 1098 1099* Cancelation once started in a thread cannot now be inadvertantly 1100double canceled. That is, once a thread begins it's cancelation run, 1101cancelation is disabled and a subsequent cancel request will 1102return an error (ESRCH). 1103 1104* errno: An incorrect compiler directive caused a local version 1105of errno to be used instead of the Win32 errno. Both instances are 1106thread-safe but applications checking errno after a pthreads-win32 1107call would be wrong. Fixing this also fixed a bad compiler 1108option in the testsuite (/MT should have been /MD) which is 1109needed to link with the correct library MSVCRT.LIB. 1110 1111 1112SNAPSHOT 2001-07-12 1113------------------- 1114 1115To be added 1116 1117 1118SNAPSHOT 2001-07-03 1119------------------- 1120 1121To be added 1122 1123 1124SNAPSHOT 2000-08-13 1125------------------- 1126 1127New: 1128- Renamed DLL and LIB files: 1129 pthreadVSE.dll (MS VC++/Structured EH) 1130 pthreadVSE.lib 1131 pthreadVCE.dll (MS VC++/C++ EH) 1132 pthreadVCE.lib 1133 pthreadGCE.dll (GNU G++/C++ EH) 1134 libpthreadw32.a 1135 1136 Both your application and the pthread dll should use the 1137 same exception handling scheme. 1138 1139Bugs fixed: 1140- MSVC++ C++ exception handling. 1141 1142Some new tests have been added. 1143 1144 1145SNAPSHOT 2000-08-10 1146------------------- 1147 1148New: 1149- asynchronous cancelation on X86 (Jason Nye) 1150- Makefile compatible with MS nmake to replace 1151 buildlib.bat 1152- GNUmakefile for Mingw32 1153- tests/Makefile for MS nmake replaces runall.bat 1154- tests/GNUmakefile for Mingw32 1155 1156Bugs fixed: 1157- kernel32 load/free problem 1158- attempt to hide internel exceptions from application 1159 exception handlers (__try/__except and try/catch blocks) 1160- Win32 thread handle leakage bug 1161 (David Baggett/Paul Redondo/Eyal Lebedinsky) 1162 1163Some new tests have been added. 1164 1165 1166SNAPSHOT 1999-11-02 1167------------------- 1168 1169Bugs fixed: 1170- ctime_r macro had an incorrect argument (Erik Hensema), 1171- threads were not being created 1172 PTHREAD_CANCEL_DEFERRED. This should have 1173 had little effect as deferred is the only 1174 supported type. (Ross Johnson). 1175 1176Some compatibility improvements added, eg. 1177- pthread_setcancelstate accepts NULL pointer 1178 for the previous value argument. Ditto for 1179 pthread_setcanceltype. This is compatible 1180 with Solaris but should not affect 1181 standard applications (Erik Hensema) 1182 1183Some new tests have been added. 1184 1185 1186SNAPSHOT 1999-10-17 1187------------------- 1188 1189Bug fix - Cancelation of threads waiting on condition variables 1190now works properly (Lorin Hochstein and Peter Slacik) 1191 1192 1193SNAPSHOT 1999-08-12 1194------------------- 1195 1196Fixed exception stack cleanup if calling pthread_exit() 1197- (Lorin Hochstein and John Bossom). 1198 1199Fixed bugs in condition variables - (Peter Slacik): 1200 - additional contention checks 1201 - properly adjust number of waiting threads after timed 1202 condvar timeout. 1203 1204 1205SNAPSHOT 1999-05-30 1206------------------- 1207 1208Some minor bugs have been fixed. See the ChangeLog file for details. 1209 1210Some more POSIX 1b functions are now included but ony return an 1211error (ENOSYS) if called. They are: 1212 1213 sem_open 1214 sem_close 1215 sem_unlink 1216 sem_getvalue 1217 1218 1219SNAPSHOT 1999-04-07 1220------------------- 1221 1222Some POSIX 1b functions which were internally supported are now 1223available as exported functions: 1224 1225 sem_init 1226 sem_destroy 1227 sem_wait 1228 sem_trywait 1229 sem_post 1230 sched_yield 1231 sched_get_priority_min 1232 sched_get_priority_max 1233 1234Some minor bugs have been fixed. See the ChangeLog file for details. 1235 1236 1237SNAPSHOT 1999-03-16 1238------------------- 1239 1240Initial release. 1241 1242