From e121b938c9f012958196a3141f04a3fd4f58bdb9 Mon Sep 17 00:00:00 2001 From: rpj Date: Thu, 31 May 2001 02:01:47 +0000 Subject: 2001-05-30 Ross Johnson * pthread.h (rand_r): Fake using _seed argument to quell compiler warning (compiler should optimise this away later). * GNUmakefile (OPT): Leave symbolic information out of the library and increase optimisation level - for smaller faster prebuilt dlls. 2001-05-29 Ross Johnson Contributed by - Milan Gardian * Makefile: fix typo. * pthreads.h: Fix problems with stdcall/cdecl conventions, in particular remove the need for PT_STDCALL everywhere; remove warning supression. * (errno): Fix the longstanding "inconsistent dll linkage" problem with errno; now also works with /MD debugging libs - warnings emerged when compiling pthreads library with /MD (or /MDd) compiler switch, instead of /MT (or /MTd) (i.e. when compiling pthreads using Multithreaded DLL CRT instead of Multithreaded statically linked CRT). * create.c (pthread_create): Likewise; fix typo. * private.c (ptw32_threadStart): Eliminate use of terminate() which doesn't throw exceptions. * Remove unnecessary #includes from a number of modules - [I had to #include malloc.h in implement.h for gcc - rpj]. 2001-05-29 Ross Johnson Contributed by - Thomas Pfaff * pthread.h (PTHREAD_MUTEX_DEFAULT): New; equivalent to PTHREAD_MUTEX_DEFAULT_NP. * (PTHREAD_MUTEX_NORMAL): Similarly. * (PTHREAD_MUTEX_ERRORCHECK): Similarly. * (PTHREAD_MUTEX_RECURSIVE): Similarly. * (pthread_mutex_setdefaultkind_np): New; Linux compatibility stub for pthread_mutexattr_settype. * (pthread_mutexattr_getkind_np): New; Linux compatibility stub for pthread_mutexattr_gettype. * mutex.c (pthread_mutexattr_settype): New; allow the following types of mutex: PTHREAD_MUTEX_DEFAULT_NP PTHREAD_MUTEX_NORMAL_NP PTHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_RECURSIVE_NP * Note that PTHREAD_MUTEX_DEFAULT is equivalent to PTHREAD_MUTEX_NORMAL - ie. mutexes should no longer be recursive by default, and a thread will deadlock if it tries to relock a mutex it already owns. This is inline with other pthreads implementations. * (pthread_mutex_lock): Process the lock request according to the mutex type. * (pthread_mutex_init): Eliminate use of Win32 mutexes as the basis of POSIX mutexes - instead, a combination of one critical section and one semaphore are used in conjunction with Win32 Interlocked* routines. * (pthread_mutex_destroy): Likewise. * (pthread_mutex_lock): Likewise. * (pthread_mutex_trylock): Likewise. * (pthread_mutex_unlock): Likewise. * Use longjmp/setjmp to implement cancelation when building the library using a C compiler which doesn't support exceptions, e.g. gcc -x c (note that gcc -x c++ uses exceptions). * Also fixed some of the same typos and eliminated PT_STDCALL as Milan Gardian's patches above. 2001-02-07 Ross Johnson Contributed by - Alexander Terekhov * rwlock.c: Revamped. * implement.h (pthread_rwlock_t_): Redefined. This implementation does not have reader/writer starvation problem. Rwlock attempts to behave more like a normal mutex with races and scheduling policy determining who is more important; It also supports recursive locking, has less synchronization overhead (no broadcasts at all, readers are not blocked on any condition variable) and seem to be faster than the current implementation [W98 appears to be approximately 15 percent faster at least - on top of speed increase from Thomas Pfaff's changes to mutex.c - rpj]. --- ANNOUNCE | 177 ++++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 123 insertions(+), 54 deletions(-) (limited to 'ANNOUNCE') diff --git a/ANNOUNCE b/ANNOUNCE index b997141..809dc7d 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ - PTHREADS-WIN32 SNAPSHOT 2000-12-29 + PTHREADS-WIN32 SNAPSHOT ????-??-?? ---------------------------------- Web Site: http://sources.redhat.com/pthreads-win32/ FTP Site: ftp://sources.redhat.com/pub/pthreads-win32 @@ -13,6 +13,10 @@ Win32 environment. Some functions from POSIX 1003.1b are also supported including semaphores. Other related functions include the set of read-write lock functions. +Parts of the implementation also comply with the Open Group's +Unix 98 specification for compatibility with major Unix +implementations and Linux. + Pthreads-win32 is free software, distributed under the GNU Library General Public License (LGPL). @@ -26,57 +30,114 @@ Change Summary (since the last snapshot) (See the ChangeLog file for details.) New: -- New non-portable functions for use when statically linking the library - (see the README file): - pthread_delay_np - pthread_win32_process_attach_np - pthread_win32_process_detach_np - pthread_win32_thread_attach_np - pthread_win32_thread_detach_np - Also, the start of support within the library for statically - linked applications, but this has not been tested by statically - linking yet. -- A fully working MinGW32 g++ compiled version of the library - is now supplied. To use with g++ compiled applications - please see the FAQ "How do I generate pthreadGCE.dll and - libpthreadw32.a for use with Mingw32", which you need to do - before compiling and linking applications as well. -- Unhandled exceptions, whether SEH or C++, are no longer - silently caught and ignored but are passed out of threads for - the system to deal with. C++ applications can override - the default termination handler via set_terminate(). - set_terminate() works fine for MinGW32 g++ but not yet with MS VC++ - (see known bugs (2)) even though it's the same code. See - tests/exception3.c for an example of using set_terminate(). +- Async cancellation should now work for Windows running + on the following processors: IX86, MIPS, ALPHA, PPC. + - contributors name misplaced (please contact me if it's you) + +- New functions (no-ops) for source code compatibility: + pthread_getconcurrency() + Returns the value previously set by + pthread_setconcurrency() or 0 (zero) + if no value was previously set. + The implementation does not currently use + this value. + pthread_setconcurrency() + Accepts any value >= 0 but does not + have any effect; returns '0' or + EINVAL if the value is < 0 + pthread_attr_getscope() + pthread_attr_setscope() + Currently only return ENOSYS + +- The following mutex types and related functions are now + supported: + + pthread_mutexattr_gettype() + pthread_mutexattr_settype() + PTHREAD_MUTEX_DEFAULT + PTHREAD_MUTEX_NORMAL or PTHREAD_MUTEX_FAST_NP + PTHREAD_MUTEX_ERRORCHECK or PTHREAD_MUTEX_ERRORCHECK_NP + PTHREAD_MUTEX_RECURSIVE or PTHREAD_MUTEX_RECURSIVE_NP + + The *_NP versions are for Linux portability. + + In this implementation PTHREAD_MUTEX_DEFAULT is + mapped to PTHREAD_MUTEX_NORMAL for compatibility + with major Unix vendors. This is also the default + if no type is specified. + + Please note that the default behaviour in previous + versions of the library was equivalent to + PTHREAD_MUTEX_RECURSIVE. This will be a problem + for some applications unless they are updated to + explicitly set the type of any mutexes that are, or + could be, locked recursively. + + PTHREAD_MUTEX_NORMAL will cause thread deadlock + if the owner of a mutex tries to relock it without + first unlocking it. It has slightly less overhead + that other types. + +- Pthreads-win32 mutexes are now based on Win32 + critical sections for all Windows versions. The + implementation no longer depends on + TryEnterCriticalSection. + - Thomas Pfaff Bugs fixed: -- Pthread_mutex_unlock() now returns EPERM if the unlocking - thread does not currently hold the thread. -- Args in the ctime_r macro in pthread.h are fixed. -- Made semaphore.h independent of config.h when building - applications. Don't know how this went unnoticed for so long - - the default defines must have been correct for my test - environment. - -Some new tests have been added. +- Pthread_mutex_trylock() now properly returns EBUSY + even when the current thread owns the mutex. + Consequently, pthread_mutex_destroy() will no longer + destroy a locked mutex (it will return EBUSY). + - Thomas Pfaff +- Errno warnings and building with /MD; + calling conventions (stdcall v cdecl); + thread termination problems; + - Milan Gardian Known bugs in this snapshot --------------------------- -1. Asynchronous cancelation only works on Intel X86 machines. - -2. Under MS VC++ (only tested with version 6.0), a term_func +1. Under MS VC++ (only tested with version 6.0), a term_func set via the standard C++ set_terminate() function is not called for some reason. The code - in private.c:ptw32_threadStart() - makes an explicit call to terminate() which works as expected under MinGW32 g++ doesn't appear to run the term_func under MC VC++ 6.0. -3. This is an interim snapshot as there are still some additional - patches to go in, eg. to fix problems with errno support under - some circumstances. Some people are seeing compile warnings - to do with _errno. +2. Cancellation problems in optimised code + - Milan Gardian + + The cancellation (actually, cleanup-after-cancel) tests fail when using VC + (professional) optimisation switches (/O1 or /O2) in pthreads library. I + have not investigated which concrete optimisation technique causes this + problem (/Og, /Oi, /Ot, /Oy, /Ob1, /Gs, /Gf, /Gy, etc.), but here is a + summary of builds and corresponding failures: + + * pthreads VSE (optimised tests): OK + * pthreads VCE (optimised tests): Failed "cleanup1" test (runtime) + + * pthreads VSE (DLL in CRT, optimised tests): OK + * pthreads VCE (DLL in CRT, optimised tests): Failed "cleanup1" test + (runtime) + + Please note that while in VSE version of the pthreads library the + optimisation does not really have any impact on the tests (they pass OK), in + VCE version addition of optimisation (/O2 in this case) causes the tests to + fail uniformly - either in "cleanup0" or "cleanup1" test cases. + + Please note that all the tests above use default pthreads DLL (no + optimisations, linked with either static or DLL CRT, based on test type). + Therefore the problem lies not within the pthreads DLL but within the + compiled client code (the application using pthreads -> involvement of + "pthread.h"). + + I think the message of this section is that usage of VCE version of pthreads + in applications relying on cancellation/cleanup AND using optimisations for + creation of production code is highly unreliable for the current version of + the pthreads library. + Caveats ------- @@ -166,7 +227,11 @@ The following functions are implemented: pthread_mutexattr_destroy pthread_mutexattr_getpshared pthread_mutexattr_setpshared - + pthread_mutexattr_gettype + pthread_mutexattr_settype (types: PTHREAD_MUTEX_DEFAULT + PTHREAD_MUTEX_NORMAL + PTHREAD_MUTEX_ERRORCHECK + PTHREAD_MUTEX_RECURSIVE ) pthread_mutex_init pthread_mutex_destroy pthread_mutex_lock @@ -219,6 +284,10 @@ The following functions are implemented: pthread_attr_setschedparam pthread_getschedparam pthread_setschedparam + pthread_getconcurrency (always returns '0' indicating system default) + pthread_setconcurrency (accepts any value >= 0 but is ignored) + pthread_attr_getscope (returns an error ENOSYS) + pthread_attr_setscope (returns an error ENOSYS) sched_get_priority_max (POSIX 1b) sched_get_priority_min (POSIX 1b) sched_yield (POSIX 1b) @@ -229,15 +298,15 @@ The following functions are implemented: pthread_sigmask --------------------------- - Non-portable routines (see the README file for usage) + Non-portable routines (see the README.NONPORTABLE file for usage) --------------------------- - pthread_mutexattr_setforcecs_np pthread_getw32threadhandle_np - pthread_delay_np - pthread_win32_process_attach_np - pthread_win32_process_detach_np - pthread_win32_thread_attach_np - pthread_win32_thread_detach_np + pthread_delay_np + pthread_mutex_setdefaulttype_np + pthread_win32_process_attach_np + pthread_win32_process_detach_np + pthread_win32_thread_attach_np + pthread_win32_thread_detach_np --------------------------- Static Initializers (macros) @@ -265,10 +334,8 @@ The following functions are not implemented: --------------------------- pthread_attr_getinheritsched pthread_attr_getschedpolicy - pthread_attr_getscope pthread_attr_setinheritsched pthread_attr_setschedpolicy - pthread_attr_setscope pthread_mutex_getprioceiling pthread_mutex_setprioceiling pthread_mutex_attr_getprioceiling @@ -344,20 +411,22 @@ Mailing List There is a mailing list for discussing pthreads on Win32. To join, send email to: - pthreads-win32-subscribe@sources.redhat.com + pthreads-win32-subscribe@sourceware.cygnus.com Application Development Environments ------------------------------------ MSVC: -MSVC using SEH works. -MSVC using C++ EH works. +MSVC using SEH works. Distribute pthreadVSE.dll with your application. +MSVC using C++ EH works. Distribute pthreadVCE.dll with your application. Mingw32: You need gcc-2.95.2-1 modified as per pthreads-win32 FAQ answer (6), with binutils-19990818-1 and msvcrt runtime-2000-03-27. Mingw32 must use -the thread-safe MSVCRT library (see the FAQ). +the thread-safe MSVCRT library (see the FAQ). You need to distribute +the gcc.dll DLL from Mingw32 with your application (as well as +pthreadGCE.dll of course). Cygwin: (http://sourceware.cygnus.com/cygwin/) Cygwin aims to provide a complete POSIX environment on top of Win32, including @@ -382,7 +451,7 @@ For convenience, the following pre-built files are available on the FTP site pthreadVCE.lib pthreadVSE.dll - built with MSVC compiler using SEH pthreadVSE.lib - pthreadGCE.dll - built with Mingw32 G++ + pthreadGCE.dll - built with Mingw32 G++ 2.95.2-1 libpthreadw32.a - derived from pthreadGCE.dll These are the only files you need in order to build POSIX threads -- cgit v1.2.3