diff options
| -rw-r--r-- | ANNOUNCE | 774 | ||||
| -rw-r--r-- | CONTRIBUTORS | 52 | ||||
| -rw-r--r-- | ChangeLog | 34 | ||||
| -rw-r--r-- | GNUmakefile | 4 | ||||
| -rw-r--r-- | Makefile | 121 | ||||
| -rw-r--r-- | README | 227 | ||||
| -rw-r--r-- | buildlib.bat | 73 | ||||
| -rw-r--r-- | cleanup.c | 4 | ||||
| -rw-r--r-- | implement.h | 2 | ||||
| -rw-r--r-- | private.c | 12 | ||||
| -rw-r--r-- | tests/ChangeLog | 20 | ||||
| -rw-r--r-- | tests/GNUmakefile | 232 | ||||
| -rw-r--r-- | tests/Makefile | 161 | ||||
| -rw-r--r-- | tests/cancel2.c | 2 | ||||
| -rw-r--r-- | tests/cancel3.c | 2 | ||||
| -rw-r--r-- | tests/cancel4.c | 2 | ||||
| -rw-r--r-- | tests/cleanup1.c | 4 | ||||
| -rw-r--r-- | tests/eyal1.c | 6 | 
18 files changed, 959 insertions, 773 deletions
| @@ -1,371 +1,403 @@ - -                 PTHREADS-WIN32 SNAPSHOT 2000-??-?? -                 ---------------------------------- -       Web Site: http://sourceware.cygnus.com/pthreads-win32/ -      FTP Site: ftp://sourceware.cygnus.com/pub/pthreads-win32 -        Coordinator: Ross Johnson <rpj@ise.canberra.edu.au> - - -We are pleased to announce the availability of a new snapshot of -Pthreads-win32, an Open Source Software (OSS) implementation of the -Threads component of the POSIX 1003.1c 1995 Standard for Microsoft's -Win32 environment. Some functions from POSIX 1003.1b are also -supported including semaphores. - -Pthreads-win32 is free software, distributed under the GNU Library -General Public License (LGPL). - -Please see the 'Acknowledgements' section at the end of this -announcement for the list of contributors. - - -Change Summary (since the last snapshot) ----------------------------------------- - -(See the ChangeLog file for details.) - -New: --	asynchronous cancelation (Jason Nye) --	Makefile compatible with MS nmake to replace -	buildlib.bat - -Bugs fixed: --	kernel32 load/free problem, --	attempt to hide internel exceptions from application -	exception handlers (__try/__except and try/catch blocks) - -Some new tests have been added. - - -Level of standards conformance ------------------------------- - -The following POSIX 1003.1c 1995 options are defined: - -      _POSIX_THREADS -      _POSIX_THREAD_SAFE_FUNCTIONS -      _POSIX_THREAD_ATTR_STACKSIZE - - -The following POSIX 1003.1c 1995 options are not defined: - -      _POSIX_THREAD_ATTR_STACKADDR -      _POSIX_THREAD_PRIORITY_SCHEDULING -      _POSIX_THREAD_PRIO_INHERIT -      _POSIX_THREAD_PRIO_PROTECT -      _POSIX_THREAD_PROCESS_SHARED - -The following POSIX 1003.1b option is defined: - -      _POSIX_SEMAPHORES - -The following functions are implemented: - -      --------------------------- -      PThreads -      --------------------------- -      pthread_attr_init -      pthread_attr_destroy -      pthread_attr_getdetachstate -      pthread_attr_getstackaddr -      pthread_attr_getstacksize -      pthread_attr_setdetachstate -      pthread_attr_setstackaddr -      pthread_attr_setstacksize - -      pthread_create -      pthread_detach -      pthread_equal -      pthread_exit -      pthread_join -      pthread_once -      pthread_self - -      pthread_cancel -      pthread_cleanup_pop -      pthread_cleanup_push -      pthread_setcancelstate -      pthread_setcanceltype -      pthread_testcancel -           -      --------------------------- -      Thread Specific Data    -      --------------------------- -      pthread_key_create -      pthread_key_delete -      pthread_setspecific -      pthread_getspecific -                 -      --------------------------- -      Mutexes -      --------------------------- -      pthread_mutexattr_init -      pthread_mutexattr_destroy -      pthread_mutexattr_getpshared -      pthread_mutexattr_setpshared - -      pthread_mutex_init -      pthread_mutex_destroy -      pthread_mutex_lock -      pthread_mutex_trylock       -      pthread_mutex_unlock - -      --------------------------- -      Condition Variables -      --------------------------- -      pthread_condattr_init -      pthread_condattr_destroy -      pthread_condattr_getpshared -      pthread_condattr_setpshared - -      pthread_cond_init -      pthread_cond_destroy -      pthread_cond_wait -      pthread_cond_timedwait -      pthread_cond_signal -      pthread_cond_broadcast   - -      --------------------------- -      Read/Write Locks: -      --------------------------- -      pthread_rwlock_init -      pthread_rwlock_destroy -      pthread_rwlock_tryrdlock -      pthread_rwlock_trywrlock -      pthread_rwlock_rdlock -      pthread_rwlock_rwlock -      pthread_rwlock_unlock - -      --------------------------- -      Semaphores -      --------------------------- -      sem_init               (POSIX 1b) -      sem_destroy            (POSIX 1b) -      sem_post               (POSIX 1b) -      sem_wait               (POSIX 1b) -      sem_trywait            (POSIX 1b) -      sem_open               (POSIX 1b - returns an error ENOSYS) -      sem_close              (POSIX 1b - returns an error ENOSYS) -      sem_unlink             (POSIX 1b - returns an error ENOSYS) -      sem_getvalue           (POSIX 1b - returns an error ENOSYS) - -      --------------------------- -      RealTime Scheduling -      --------------------------- -      pthread_attr_getschedparam   -      pthread_attr_setschedparam   -      pthread_getschedparam -      pthread_setschedparam -      sched_get_priority_max (POSIX 1b) -      sched_get_priority_min (POSIX 1b) -      sched_yield            (POSIX 1b) - -      --------------------------- -      Signals -      --------------------------- -      pthread_sigmask - -      --------------------------- -      Static Initializers (macros) -      --------------------------- -      PTHREAD_ONCE_INIT -      PTHREAD_MUTEX_INITIALIZER -      PTHREAD_COND_INITIALIZER -      PTHREAD_RWLOCK_INITIALIZER -       -      --------------------------- -      Thread-Safe C Runtime Library (macros) -      --------------------------- -      strtok_r -      asctime_r -      ctime_r -      gmtime_r -      localtime_r -      rand_r - - -The following functions are not implemented: -       -      --------------------------- -      RealTime Scheduling -      --------------------------- -      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 -      pthread_mutex_attr_getprotocol -      pthread_mutex_attr_setprioceiling -      pthread_mutex_attr_setprotocol -       -      --------------------------- -      Fork Handlers -      --------------------------- -      pthread_atfork - -      --------------------------- -      Stdio -      ---------------------------  -      flockfile -      ftrylockfile -      funlockfile -      getc_unlocked -      getchar_unlocked   -      putc_unlocked -      putchar_unlocked - -      --------------------------- -      Thread-Safe C Runtime Library -      --------------------------- -      readdir_r -      getgrgid_r -      getgrnam_r -      getpwuid_r -      getpwnam_r -       -      --------------------------- -      Signals -      --------------------------- -      pthread_kill -      sigtimedwait -      sigwait -      sigwaitinfo -       -       -The library includes two non-API functions for creating cancellation -points in applications and libraries: -       -      pthreadCancelableWait -      pthreadCancelableTimedWait - -       -Availability -------------  - -The prebuilt DLL, export libs (for both MSVC and Mingw32), and the header -files (pthread.h, semaphore.h, sched.h) are available along with the -complete source code. - -The source code can be found at: - -	ftp://sourceware.cygnus.com/pub/pthreads-win32 - -and as individual source code files at - -	ftp://sourceware.cygnus.com/pub/pthreads-win32/source - -The pre-built DLL, export libraries and include files can be found at: - -	ftp://sourceware.cygnus.com/pub/pthreads-win32/dll-latest - - -       -Mailing List  -------------   -       -There is a mailing list for discussing pthreads on Win32. To join, -send email to: - -        pthreads-win32-subscribe@sourceware.cygnus.com -       - -Application Development Environments ------------------------------------- -       -MSVC: -MSVC works. - -Mingw32: (ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/egcs-1.1.1/) -Mingw32 must use the thread-safe MSVCRT library (see the FAQ). You can link -against the export library libpthread32.a built under Mingw32 -but you must run your application with the version of pthread.dll built -with MSVC. -       -Cygwin: (http://sourceware.cygnus.com/cygwin/) -Cygwin aims to provide a complete POSIX environment on top of Win32, including -threads. When this is complete, developers using Cygwin will not need -pthreads-win32. At this time, Cygwin has preliminary support for multithreaded -development, however, this is not turned on by default. We have not tested -pthreads-win32 against Cygwin. - -Generally: -For convenience, the following pre-built files are available on the FTP site -(see Availability above): - -        pthread.h       - for POSIX 1c threads -        semaphore.h     - for POSIX 1b semaphores -        sched.h         - for POSIX 1b scheduling -        pthread.dll     - built with MSVC cl compiler on NT4.0 -        pthread.lib     - built with MSVC cl compiler on NT4.0 -        libpthread32.a  - built with Mingw32 on Win98 (use with -                          MSVC pthread.dll for runtime) - -These are the only files you need in order to build POSIX threads -applications for Win32 using either MSVC or Mingw32. -       -See the FAQ file in the source tree for additional information. - - -Why you can't build the DLL itself with Mingw32 (yet) ------------------------------------------------------ - -The library makes use of exception handling internally (Win32 SEH if -compiled with MSVC and C++ EH otherwise). Unfortunately, current -versions of egcs (g++) do not have thread-safe exception handling -and therefore the DLL pthread.dll cannot be built. - -However, it is possible to build applications which make use of -pthreads-win32, using Mingw32's gcc or g++. - - -Building the library with MSVC ------------------------------- - -A simple makefile for building the library with MSVC is available. The -Makefile by default links the library to MSVCRT.DLL. If your application -uses another C runtime library like LIBCMT.LIB, please edit the Makefile to -avoid conflicts between C-libraries. - -There is also a batch file "buildlib.bat" which will build the library. - - -Documentation -------------- - -Currently, there is no documentation included in the package apart -from the copious comments in the source code. - -For POSIX Thread API programming, several reference books are -available:   - -        Programming with POSIX Threads -        David R. Butenhof -        Addison-Wesley (pub) - -        Pthreads Programming -        By Bradford Nichols, Dick Buttlar & Jacqueline Proulx Farrell -        O'Reilly (pub) -       - -Acknowledgements ----------------- -       -This library is based substantially on a Win32 pthreads -implementation contributed by John Bossom <John.Bossom@cognos.com>. -       -The implementation of condition variables is derived from the work -of Douglas Schmidt et al -(http://www.cs.wustl.edu/~schmidt/win32-cv-1.html). - -There is also a separate CONTRIBUTORS file. This file and others are -on the web site: - -        http://sourceware.cygnus.com/pthreads-win32 - -Enjoy! - -Ross Johnson +
 +                 PTHREADS-WIN32 SNAPSHOT 2000-08-10
 +                 ----------------------------------
 +       Web Site: http://sources.redhat.com/pthreads-win32/
 +      FTP Site: ftp://sources.redhat.com/pub/pthreads-win32
 +        Coordinator: Ross Johnson <rpj@ise.canberra.edu.au>
 +
 +
 +We are pleased to announce the availability of a new snapshot of
 +Pthreads-win32, an Open Source Software (OSS) implementation of the
 +Threads component of the POSIX 1003.1c 1995 Standard for Microsoft's
 +Win32 environment. Some functions from POSIX 1003.1b are also
 +supported including semaphores. Other related functions include
 +the set of read-write lock functions.
 +
 +Pthreads-win32 is free software, distributed under the GNU Library
 +General Public License (LGPL).
 +
 +Please see the 'Acknowledgements' section at the end of this
 +announcement for the list of contributors.
 +
 +
 +Change Summary (since the last snapshot)
 +----------------------------------------
 +
 +(See the ChangeLog file for details.)
 +
 +New:
 +-	asynchronous cancelation on X86 (Jason Nye)
 +-	Makefile compatible with MS nmake to replace
 +	buildlib.bat
 +-	GNUmakefile for Mingw32
 +-	tests/Makefile for MS nmake replaces runall.bat
 +-	tests/GNUmakefile for Mingw32
 +
 +Bugs fixed:
 +-	kernel32 load/free problem
 +-	attempt to hide internel exceptions from application
 +	exception handlers (__try/__except and try/catch blocks)
 +-	Win32 thread handle leakage bug
 +	(David Baggett/Paul Redondo/Eyal Lebedinsky)
 +
 +Some new tests have been added.
 +
 +
 +Known bugs in this snapshot
 +---------------------------
 +
 +1. Running the test "join1.c" with the library built with Mingw32
 +and the GNUmakefile included, the test fails with a segmentation (invalid
 +page access) exception. The fault appears to be in the assembler code
 +emmitted by the compiler [to handle exception contexts] at the
 +end of the try block in _pthread_threadStart().
 +
 +2. There are problems with using the libpthread32.a file with the
 +VC++ SEH version of pthread.dll. The cleanup1.c test fails and the
 +eyal1.c test gives suspect results.
 +
 +3. I have not been able to build with VC++ using C++ EH. This is a
 +maintainer problem who doesn't think he's doing it right. Consequently
 +there may also be basic parser errors and warnings to be cleaned
 +up in the code.
 +
 +4. Due to what is believed to be a C++ compliance error in VC++,
 +if your application contains catch(...) blocks in your POSIX threads
 +then you will need to replace the "catch(...)" with the macro
 +"PtW32Catch", eg.
 +
 +	#ifdef PtW32Catch
 +		PtW32Catch {
 +			...
 +		}
 +	#else
 +		catch(...) {
 +			...
 +		}
 +	#endif
 +
 +Otherwise neither pthreads cancelation nor pthread_exit() will work
 +reliably.
 +
 +
 +Level of standards conformance
 +------------------------------
 +
 +The following POSIX 1003.1c 1995 options are defined:
 +
 +      _POSIX_THREADS
 +      _POSIX_THREAD_SAFE_FUNCTIONS
 +      _POSIX_THREAD_ATTR_STACKSIZE
 +
 +
 +The following POSIX 1003.1c 1995 options are not defined:
 +
 +      _POSIX_THREAD_ATTR_STACKADDR
 +      _POSIX_THREAD_PRIORITY_SCHEDULING
 +      _POSIX_THREAD_PRIO_INHERIT
 +      _POSIX_THREAD_PRIO_PROTECT
 +      _POSIX_THREAD_PROCESS_SHARED
 +
 +The following POSIX 1003.1b option is defined:
 +
 +      _POSIX_SEMAPHORES
 +
 +The following functions are implemented:
 +
 +      ---------------------------
 +      PThreads
 +      ---------------------------
 +      pthread_attr_init
 +      pthread_attr_destroy
 +      pthread_attr_getdetachstate
 +      pthread_attr_getstackaddr
 +      pthread_attr_getstacksize
 +      pthread_attr_setdetachstate
 +      pthread_attr_setstackaddr
 +      pthread_attr_setstacksize
 +
 +      pthread_create
 +      pthread_detach
 +      pthread_equal
 +      pthread_exit
 +      pthread_join
 +      pthread_once
 +      pthread_self
 +
 +      pthread_cancel
 +      pthread_cleanup_pop
 +      pthread_cleanup_push
 +      pthread_setcancelstate
 +      pthread_setcanceltype
 +      pthread_testcancel
 +          
 +      ---------------------------
 +      Thread Specific Data   
 +      ---------------------------
 +      pthread_key_create
 +      pthread_key_delete
 +      pthread_setspecific
 +      pthread_getspecific
 +                
 +      ---------------------------
 +      Mutexes
 +      ---------------------------
 +      pthread_mutexattr_init
 +      pthread_mutexattr_destroy
 +      pthread_mutexattr_getpshared
 +      pthread_mutexattr_setpshared
 +
 +      pthread_mutex_init
 +      pthread_mutex_destroy
 +      pthread_mutex_lock
 +      pthread_mutex_trylock      
 +      pthread_mutex_unlock
 +
 +      ---------------------------
 +      Condition Variables
 +      ---------------------------
 +      pthread_condattr_init
 +      pthread_condattr_destroy
 +      pthread_condattr_getpshared
 +      pthread_condattr_setpshared
 +
 +      pthread_cond_init
 +      pthread_cond_destroy
 +      pthread_cond_wait
 +      pthread_cond_timedwait
 +      pthread_cond_signal
 +      pthread_cond_broadcast  
 +
 +      ---------------------------
 +      Read/Write Locks:
 +      ---------------------------
 +      pthread_rwlock_init
 +      pthread_rwlock_destroy
 +      pthread_rwlock_tryrdlock
 +      pthread_rwlock_trywrlock
 +      pthread_rwlock_rdlock
 +      pthread_rwlock_rwlock
 +      pthread_rwlock_unlock
 +
 +      ---------------------------
 +      Semaphores
 +      ---------------------------
 +      sem_init               (POSIX 1b)
 +      sem_destroy            (POSIX 1b)
 +      sem_post               (POSIX 1b)
 +      sem_wait               (POSIX 1b)
 +      sem_trywait            (POSIX 1b)
 +      sem_open               (POSIX 1b - returns an error ENOSYS)
 +      sem_close              (POSIX 1b - returns an error ENOSYS)
 +      sem_unlink             (POSIX 1b - returns an error ENOSYS)
 +      sem_getvalue           (POSIX 1b - returns an error ENOSYS)
 +
 +      ---------------------------
 +      RealTime Scheduling
 +      ---------------------------
 +      pthread_attr_getschedparam  
 +      pthread_attr_setschedparam  
 +      pthread_getschedparam
 +      pthread_setschedparam
 +      sched_get_priority_max (POSIX 1b)
 +      sched_get_priority_min (POSIX 1b)
 +      sched_yield            (POSIX 1b)
 +
 +      ---------------------------
 +      Signals
 +      ---------------------------
 +      pthread_sigmask
 +
 +      ---------------------------
 +      Static Initializers (macros)
 +      ---------------------------
 +      PTHREAD_ONCE_INIT
 +      PTHREAD_MUTEX_INITIALIZER
 +      PTHREAD_COND_INITIALIZER
 +      PTHREAD_RWLOCK_INITIALIZER
 +      
 +      ---------------------------
 +      Thread-Safe C Runtime Library (macros)
 +      ---------------------------
 +      strtok_r
 +      asctime_r
 +      ctime_r
 +      gmtime_r
 +      localtime_r
 +      rand_r
 +
 +
 +The following functions are not implemented:
 +      
 +      ---------------------------
 +      RealTime Scheduling
 +      ---------------------------
 +      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
 +      pthread_mutex_attr_getprotocol
 +      pthread_mutex_attr_setprioceiling
 +      pthread_mutex_attr_setprotocol
 +      
 +      ---------------------------
 +      Fork Handlers
 +      ---------------------------
 +      pthread_atfork
 +
 +      ---------------------------
 +      Stdio
 +      --------------------------- 
 +      flockfile
 +      ftrylockfile
 +      funlockfile
 +      getc_unlocked
 +      getchar_unlocked  
 +      putc_unlocked
 +      putchar_unlocked
 +
 +      ---------------------------
 +      Thread-Safe C Runtime Library
 +      ---------------------------
 +      readdir_r
 +      getgrgid_r
 +      getgrnam_r
 +      getpwuid_r
 +      getpwnam_r
 +      
 +      ---------------------------
 +      Signals
 +      ---------------------------
 +      pthread_kill
 +      sigtimedwait
 +      sigwait
 +      sigwaitinfo
 +      
 +      
 +The library includes two non-API functions for creating cancellation
 +points in applications and libraries:
 +      
 +      pthreadCancelableWait
 +      pthreadCancelableTimedWait
 +
 +      
 +Availability
 +------------ 
 +
 +The prebuilt DLL, export libs (for both MSVC and Mingw32), and the header
 +files (pthread.h, semaphore.h, sched.h) are available along with the
 +complete source code.
 +
 +The source code can be found at:
 +
 +	ftp://sourcs.redhat.com/pub/pthreads-win32
 +
 +and as individual source code files at
 +
 +	ftp://sources.redhat.com/pub/pthreads-win32/source
 +
 +The pre-built DLL, export libraries and include files can be found at:
 +
 +	ftp://sources.redhat.com/pub/pthreads-win32/dll-latest
 +
 +
 +      
 +Mailing List 
 +------------  
 +      
 +There is a mailing list for discussing pthreads on Win32. To join,
 +send email to:
 +
 +        pthreads-win32-subscribe@sourceware.cygnus.com
 +      
 +
 +Application Development Environments
 +------------------------------------
 +      
 +MSVC:
 +MSVC using SEH works.
 +MSVC using C++ EH not tested.
 +
 +Mingw32: (ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/egcs-1.1.1/)
 +Mingw32 must use the thread-safe MSVCRT library (see the FAQ). You can link
 +against the export library libpthread32.a built under Mingw32
 +but you must run your application with the version of pthread.dll built
 +with MSVC. See the "Known bugs" section above.
 +      
 +Cygwin: (http://sourceware.cygnus.com/cygwin/)
 +Cygwin aims to provide a complete POSIX environment on top of Win32, including
 +threads. When this is complete, developers using Cygwin will not need
 +pthreads-win32. At this time, Cygwin has preliminary support for multithreaded
 +development, however, this is not turned on by default. We have not tested
 +pthreads-win32 against Cygwin.
 +
 +Generally:
 +For convenience, the following pre-built files are available on the FTP site
 +(see Availability above):
 +
 +        pthread.h       - for POSIX 1c threads
 +        semaphore.h     - for POSIX 1b semaphores
 +        sched.h         - for POSIX 1b scheduling
 +        pthread.dll     - built with MSVC cl compiler on NT4.0
 +        pthread.lib     - built with MSVC cl compiler on NT4.0
 +        libpthread32.a  - built with Mingw32 on Win98 (use with
 +                          MSVC pthread.dll for runtime)
 +
 +These are the only files you need in order to build POSIX threads
 +applications for Win32 using either MSVC or Mingw32.
 +      
 +See the FAQ file in the source tree for additional information.
 +
 +
 +Building the library with MSVC
 +------------------------------
 +
 +A simple makefile for building the library with MSVC is available. The
 +Makefile by default links the library to MSVCRT.DLL. If your application
 +uses another C runtime library like LIBCMT.LIB, please edit the Makefile to
 +avoid conflicts between C-libraries.
 +
 +There is also a batch file "buildlib.bat" which will build the library.
 +
 +
 +Documentation
 +-------------
 +
 +Currently, there is no documentation included in the package apart
 +from the copious comments in the source code.
 +
 +For POSIX Thread API programming, several reference books are
 +available:  
 +
 +        Programming with POSIX Threads
 +        David R. Butenhof
 +        Addison-Wesley (pub)
 +
 +        Pthreads Programming
 +        By Bradford Nichols, Dick Buttlar & Jacqueline Proulx Farrell
 +        O'Reilly (pub)
 +      
 +
 +Acknowledgements
 +----------------
 +      
 +This library is based substantially on a Win32 pthreads
 +implementation contributed by John Bossom <John.Bossom@cognos.com>.
 +      
 +The implementation of condition variables is derived from the work
 +of Douglas Schmidt et al
 +(http://www.cs.wustl.edu/~schmidt/win32-cv-1.html).
 +
 +There is also a separate CONTRIBUTORS file. This file and others are
 +on the web site:
 +
 +        http://sources.redhat.com/pthreads-win32
 +
 +Enjoy!
 +
 +Ross Johnson
 diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d14b7e0..044225c 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,24 +1,28 @@ -Contributors (in approximate order of appearance) - -Ben Elliston		bje@cygnus.com -Ross Johnson		rpj@ise.canberra.edu.au -Robert Colquhoun	rjc@trump.net.au -John E. Bossom		John.Bossom@cognos.com -Anders Norlander	anorland@hem2.passagen.se -Tor Lillqvist		tml@iki.fi -Kevin Ruland		Kevin.Ruland@anheuser-busch.com -Mike Russo		miker@eai.com -Mark E. Armstrong	avail@pacbell.net -Lorin Hochstein		lmh@xiphos.ca -Peter Slacik		Peter.Slacik@tatramed.sk -Mumit Khan		khan@xraylith.wisc.edu -Aurelio Medina		aureliom@crt.com -Milan Gardian		mg@tatramed.sk -Graham Dumpleton	Graham.Dumpleton@ra.pad.otc.telstra.com.au -Tristan Savatier	tristan@mpegtv.com -Erik Hensema		erik@hensema.xs4all.nl -Rich Peters		rpeters@micro-magic.com -Todd Owen		towen@lucidcalm.dropbear.id.au -Jason Nye		jnye@nbnet.nb.ca -Fred Forester		fforest@eticomm.net -Kevin D. Clark		kclark@cabletron.com +Contributors (in approximate order of appearance)
 +
 +Ben Elliston		bje@cygnus.com
 +Ross Johnson		rpj@ise.canberra.edu.au
 +Robert Colquhoun	rjc@trump.net.au
 +John E. Bossom		John.Bossom@cognos.com
 +Anders Norlander	anorland@hem2.passagen.se
 +Tor Lillqvist		tml@iki.fi
 +Kevin Ruland		Kevin.Ruland@anheuser-busch.com
 +Eyal Lebedinsky		eyal@eyal.emu.id.au
 +Mike Russo		miker@eai.com
 +Mark E. Armstrong	avail@pacbell.net
 +Lorin Hochstein		lmh@xiphos.ca
 +Peter Slacik		Peter.Slacik@tatramed.sk
 +Mumit Khan		khan@xraylith.wisc.edu
 +Aurelio Medina		aureliom@crt.com
 +Milan Gardian		mg@tatramed.sk
 +Graham Dumpleton	Graham.Dumpleton@ra.pad.otc.telstra.com.au
 +Tristan Savatier	tristan@mpegtv.com
 +Erik Hensema		erik@hensema.xs4all.nl
 +Rich Peters		rpeters@micro-magic.com
 +Todd Owen		towen@lucidcalm.dropbear.id.au
 +Jason Nye		jnye@nbnet.nb.ca
 +Fred Forester		fforest@eticomm.net
 +Kevin D. Clark		kclark@cabletron.com
 +David Baggett		dmb@itasoftware.com
 +Paul Redondo		paul@matchvision.com
 +Scott McCaskill		scott@3dfx.com
 @@ -1,3 +1,37 @@ +2000-08-10  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* cleanup.c (pthread_pop_cleanup): Remove _pthread +	prefix from __except and catch keywords; implement.h +	now simply undefines _pthread__except and +	_pthread_catch if defined; VC++ was not textually +	substituting _pthread_catch etc back to catch as +	it was redefined; the reason for using the prefixed +	version was to make it clear that it was not using +	the pthread.h redefined catch keyword. + +	* private.c (_pthread_threadStart): Ditto. +	(_pthread_callUserDestroyRoutines): Ditto. + +	* implement.h (_pthread__except): Remove #define. +	(_pthread_catch): Remove #define. + +	* GNUmakefile (pthread.a): New target to build +	libpthread32.a from pthread.dll using dlltool. + +	* buildlib.bat: Duplicate cl commands with args to +	build C++ EH version of pthread.dll; use of .bat +	files is redundant now that nmake compatible +	Makefile is included; used as a kludge only now. + +	* Makefile: Localise some macros and fix up the clean: +	target to extend it and work properly. + +	* CONTRIBUTORS: Add contributors. + +	* ANNOUNCE: Updated. + +	* README: Updated. +  2000-08-06  Ross Johnson  <rpj@special.ise.canberra.edu.au>  	* pthread.h: Remove #warning - VC++ doesn't accept it. diff --git a/GNUmakefile b/GNUmakefile index 1405942..b10e358 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -49,6 +49,10 @@ LIB	= libpthread32.a  all:	$(LIB) +pthread.a: +	dlltool --def $(DLL:.dll=.def) --output-lib $@ --dllname $(DLL) +	rename pthread.a $(LIB) +  $(LIB): $(DLL)  	dlltool --def $(DLL:.dll=.def) --output-lib $@ --dllname $(DLL) @@ -1,64 +1,67 @@ - -# This makefile is compatible with MS nmake and can be used as a -# replacement for buildlib.bat. I've changed the target from an ordinary dll -# (/LD) to a debugging dll (/LDd). -#  -# The variables $DLLDEST and $LIBDEST hold the destination directories for the -# dll and the lib, respectively. Probably all that needs to change is $DEVROOT. - -DEVROOT=e: - -DLLDEST=$(DEVROOT)\dll -LIBDEST=$(DEVROOT)\lib - -#CLIB	= /MD +
 +# This makefile is compatible with MS nmake and can be used as a
 +# replacement for buildlib.bat. I've changed the target from an ordinary dll
 +# (/LD) to a debugging dll (/LDd).
 +# 
 +# The variables $DLLDEST and $LIBDEST hold the destination directories for the
 +# dll and the lib, respectively. Probably all that needs to change is $DEVROOT.
 +
 +DEVROOT=c:\pthreads\dll
 +
 +DLLDEST=$(DEVROOT)
 +LIBDEST=$(DEVROOT)
 +
 +#CLIB	= /MD
  CLIB	= /MT
 -CFLAGS	= #/EHsc /TP - -OBJ=attr.obj \ -	cancel.obj \ -	cleanup.obj \ -	condvar.obj \ -	create.obj \ -	dll.obj \ -	errno.obj \ -	exit.obj \ -	fork.obj \ -	global.obj \ -	misc.obj \ -	mutex.obj \ -	private.obj \ -	rwlock.obj \ -	sched.obj \ -	semaphore.obj \ -	signal.obj \ -	sync.obj \ -	tsd.obj - -all: pthread.dll - -clean: -	del pthread.dll \ -		pthread.lib \ -		*.obj - - -install: all -	copy pthread.dll $(DLLDEST) -	copy pthread.lib $(LIBDEST) - -pthread.dll: $(OBJ) pthread.def +CCFLAGS	= #/EHsc /TP /D_cplusplus
 +
 +OBJ=attr.obj \
 +	cancel.obj \
 +	cleanup.obj \
 +	condvar.obj \
 +	create.obj \
 +	dll.obj \
 +	errno.obj \
 +	exit.obj \
 +	fork.obj \
 +	global.obj \
 +	misc.obj \
 +	mutex.obj \
 +	private.obj \
 +	rwlock.obj \
 +	sched.obj \
 +	semaphore.obj \
 +	signal.obj \
 +	sync.obj \
 +	tsd.obj
 +
 +all: pthread.dll
 +
 +clean:
 +	del pthread.dll
 +	del pthread.lib
 +	del *.obj
 +	del *.ilk
 +	del *.pdb
 +	del *.o
 +
 +
 +install: all
 +	copy pthread.dll $(DLLDEST)
 +	copy pthread.lib $(LIBDEST)
 +
 +pthread.dll: $(OBJ) pthread.def
  	cl /LD /Zi $(CFLAGS) $(OBJ) /Fepthread.dll /link \
  	    /nodefaultlib:libcmt \
  		/implib:pthread.lib \
  		msvcrt.lib \
 -		/def:pthread.def - -.c.obj:: -	cl /W3 $(CLIB) $(CFLAGS) /nologo /Yd /Zi /I. \ -		/D_WIN32_WINNT=0x400 \ -		/DSTDCALL=_stdcall \ -		-c $< - -$(OBJ): - +		/def:pthread.def
 +
 +.c.obj::
 +	cl /W3 $(CLIB) $(CFLAGS) /nologo /Yd /Zi /I. \
 +		/D_WIN32_WINNT=0x400 \
 +		/DSTDCALL=_stdcall \
 +		-c $<
 +
 +$(OBJ):
 +
 @@ -1,84 +1,143 @@ -PTHREADS-WIN32 -============== - -Pthreads-win32 is free software, distributed under the GNU Library -General Public License (LGPL). See the file 'COPYING.LIB' for terms -and conditions. - -Mailing list ------------- - -There is a mailing list for discussing pthreads on Win32. To join, send email -to: - -	pthreads-win32-subscribe@sourceware.cygnus.com - - -Acknowledgements ----------------- - -Pthreads-win32 is based substantially on a Win32 Pthreads implementation -contributed by John E. Bossom <jebossom@cognos.com>. - -See the 'CONTRIBUTORS' file for the list of contributors. - - -Building under Mingw32 ----------------------- - -pthread.dll can be build with the current development version of mingw32. -Use the GNUmakefile with GNU make should do the right thing. - - -Why you cannot build the library with Cygwin yet ------------------------------------------------- - -The DLL pthread.dll still cannot be built using g++ due to non thread-safe -exception handling in g++.  Thanks to Kevin Ruland for researching this -one. See the FAQ Question 2 for more information. - -However, you can use the export library libpthread32.a built under -Mingw32 (not tested under Cygwin) together with the pthread.dll built -with MSVC. Thanks to Anders Norlander for pointing this out. - -For convenience, the following pre-built files can be downloaded from -the FTP site (see under "Availability" below): - -	pthread.h -	semaphore.h -	sched.h -	pthread.dll	- built with MSVC cl compiler -	pthread.lib	- built with MSVC cl compiler -	libpthread32.a	- built with Mingw32 (use with MSVC pthread.dll) - -With these files in the same directory as your application myapp.c, -you could compile, link and run myapp.c under Mingw32 as follows: - -	gcc -o myapp.exe myapp.c -I. -L. -lpthread32 -	myapp - -Or put pthread.dll in an appropriate directory in your PATH, -put libpthread32.a in MINGW_ROOT\i386-mingw32\lib, and -put pthread.h in MINGW_ROOT\i386-mingw32\include, then use: - -	gcc -o myapp.exe myapp.c -lpthread32 -	myapp - - -Availability ------------- - -The complete source code in either unbundled or tar/gzipped format -can be found at: -	ftp://sourceware.cygnus.com/pub/pthreads-win32 - -The pre-built DLL, export libraries and matching pthread.h can be found at: -	ftp://sourceware.cygnus.com/pub/pthreads-win32/dll-latest - -Home page: -	http://sourceware.cygnus.com/pthreads-win32/ - ----- -Ross Johnson -<rpj@ise.canberra.edu.au> - +PTHREADS-WIN32
 +==============
 +
 +Pthreads-win32 is free software, distributed under the GNU Library
 +General Public License (LGPL). See the file 'COPYING.LIB' for terms
 +and conditions.
 +
 +Mailing list
 +------------
 +
 +There is a mailing list for discussing pthreads on Win32. To join, send email
 +to:
 +
 +	pthreads-win32-subscribe@sources.redhat.com
 +
 +Unsubscribe by sending mail to:
 +
 +	pthreads-win32-unsubscribe@sources.redhat.com
 +
 +
 +Acknowledgements
 +----------------
 +
 +Pthreads-win32 is based substantially on a Win32 Pthreads implementation
 +contributed by John E. Bossom <jebossom@cognos.com>. Many others
 +have contributed important new code and bug fixes.
 +
 +See the 'CONTRIBUTORS' file for the list of contributors.
 +
 +
 +Known bugs in this snapshot
 +---------------------------
 +
 +1. Running the test "join1.c" with the library built with Mingw32
 +and the GNUmakefile included, the test fails with a segmentation (invalid
 +page access) exception. The fault appears to be in the assembler code
 +emmitted by the compiler [to handle exception contexts] at the
 +end of the try block in _pthread_threadStart().
 +
 +2. There are problems with using the libpthread32.a file derived
 +from the VC++ SEH version of pthread.dll. You may have to wait until
 +bug(1.) is fixed.
 +
 +3. I have not been able to build with VC++ using C++ EH. This is a
 +maintainer problem who doesn't know how to do it. Consequently
 +there may also be basic parser errors and warnings to be cleaned
 +up in the code.
 +
 +4. Due to what is believed to be C++ compliance error in VC++,
 +if your application contains catch(...) blocks in your POSIX threads
 +then you will need to replace the "catch(...)" with the macro
 +"PtW32Catch", eg.
 +
 +	#ifdef PtW32Catch
 +		PtW32Catch {
 +			...
 +		}
 +	#else
 +		catch(...) {
 +			...
 +		}
 +	#endif
 +
 +Otherwise neither pthreads cancelation nor pthread_exit() will work
 +reliably.
 +
 +
 +Building under Mingw32
 +----------------------
 +
 +pthread.dll can be built with the current development version of mingw32.
 +Run "make" in the soruce directory (uses GNUmakefile). This builds
 +pthread.dll and libpthread32.a.
 +
 +You can run the testsuite by changing to the "tests" directory and
 +running "make clean" and then "make". See the "Known bugs" section above.
 +
 +
 +Building under VC++ using SEH
 +-----------------------------
 +
 +From the source directory run "nmake". This builds pthread.dll and
 +pthread.lib.
 +
 +You can run the testsuite by changing to the "tests" directory and
 +running "nmake clean" and then "nmake".
 +
 +
 +Why you cannot build the library with Cygwin yet
 +------------------------------------------------
 +
 +The DLL pthread.dll still cannot be built using g++ due to non thread-safe
 +exception handling in g++.  Thanks to Kevin Ruland for researching this
 +one. See the FAQ Question 2 for more information.
 +
 +However, you can use the export library libpthread32.a built under
 +Mingw32 (not tested under Cygwin) together with the pthread.dll built
 +with MSVC. Thanks to Anders Norlander for pointing this out.
 +
 +For convenience, the following pre-built files can be downloaded from
 +the FTP site (see under "Availability" below):
 +
 +	pthread.h
 +	semaphore.h
 +	sched.h
 +	pthread.dll	- built with MSVC cl compiler
 +	pthread.lib	- built with MSVC cl compiler
 +	libpthread32.a	- built with Mingw32 (use with MSVC pthread.dll)
 +
 +With these files in the same directory as your application myapp.c,
 +you could compile, link and run myapp.c under Mingw32 as follows:
 +
 +	gcc -o myapp.exe myapp.c -I. -L. -lpthread32
 +	myapp
 +
 +Or put pthread.dll in an appropriate directory in your PATH,
 +put libpthread32.a in MINGW_ROOT\i386-mingw32\lib, and
 +put pthread.h in MINGW_ROOT\i386-mingw32\include, then use:
 +
 +	gcc -o myapp.exe myapp.c -lpthread32
 +	myapp
 +
 +
 +Availability
 +------------
 +
 +The complete source code in either unbundled, self-extracting
 +Zip file, or tar/gzipped format can be found at:
 +
 +	ftp://sources.redhat.com/pub/pthreads-win32
 +
 +The pre-built DLL, export libraries and matching pthread.h can be found at:
 +
 +	ftp://sources.redhat.com/pub/pthreads-win32/dll-latest
 +
 +Home page:
 +
 +	http://sources.redhat.com/pthreads-win32/
 +
 +----
 +Ross Johnson
 +<rpj@ise.canberra.edu.au>
 +
 diff --git a/buildlib.bat b/buildlib.bat index 63eea0a..d64b4ed 100644 --- a/buildlib.bat +++ b/buildlib.bat @@ -1,27 +1,52 @@  del *.obj
 -del pthread.dll
 -
 -set EH=
 -
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c attr.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c cancel.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c cleanup.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c condvar.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c create.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c dll.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c exit.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c fork.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c global.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c misc.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c mutex.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c private.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c sched.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c signal.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c sync.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c tsd.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c semaphore.c
 -cl /W3 %EH% /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall -c rwlock.c
 -
 -cl /LD %EH% /Zi *.obj /Fepthread.dll /link /nodefaultlib:libcmt /implib:pthread.lib msvcrt.lib /def:pthread.def
 +del pthread_*.dll
 +if x%1==x goto seh
 +goto %1
 +
 +:seh
 +
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c attr.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c cancel.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c cleanup.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c condvar.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c create.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c dll.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c exit.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c fork.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c global.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c misc.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c mutex.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c private.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c sched.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c signal.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c sync.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c tsd.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c semaphore.c
 +cl /W3 -DSTDCALL=_stdcall /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c rwlock.c
 +
 +cl /LD /Zi *.obj /Fepthread_SEH.dll /link /nodefaultlib:libcmt /implib:pthread.lib msvcrt.lib /def:pthread.def
 +
 +:ceh
 +
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c attr.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c cancel.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c cleanup.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c condvar.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c create.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c dll.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c exit.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c fork.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c global.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c misc.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c mutex.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c private.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c sched.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c signal.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c sync.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c tsd.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c semaphore.c
 +cl /W3 /GX /TP -D_cplusplus -DSTDCALL=_cdecl /MT /nologo /Yd /Zi -I. -D_WIN32_WINNT=0x400 -c rwlock.c
 +
 +cl /LD /Zi *.obj /Fepthread_C++.dll /link /nodefaultlib:libcmt /implib:pthread.lib msvcrt.lib /def:pthread.def
 @@ -85,7 +85,7 @@ pthread_pop_cleanup (int execute)  	       */  	      (*cleanup->routine) (cleanup->arg);  	    } -          _pthread__except (EXCEPTION_EXECUTE_HANDLER) +          __except (EXCEPTION_EXECUTE_HANDLER)  	    {  	      /*  	       * A system unexpected exception had occurred @@ -105,7 +105,7 @@ pthread_pop_cleanup (int execute)  	       */  	      (*cleanup->routine) (cleanup->arg);  	    } -	  _pthread_catch(...) +      catch(...)  	    {  	      /*  	       * A system unexpected exception had occurred diff --git a/implement.h b/implement.h index 76adb1f..b76848d 100644 --- a/implement.h +++ b/implement.h @@ -293,7 +293,6 @@ struct ThreadKeyAssoc {   */  #ifdef __except  #undef __except -#define _pthread__except __except  #endif  #else @@ -304,7 +303,6 @@ struct ThreadKeyAssoc {   */  #ifdef catch  #undef catch -#define _pthread_catch catch  #endif  #else /* __cplusplus */ @@ -223,7 +223,7 @@ _pthread_threadStart (ThreadParms * threadParms)       */      status = (*start) (arg);    } -  _pthread__except (ExceptionFilter(GetExceptionInformation(), ei)) +  __except (ExceptionFilter(GetExceptionInformation(), ei))    {      DWORD ec = GetExceptionCode(); @@ -264,21 +264,21 @@ _pthread_threadStart (ThreadParms * threadParms)       */      status = self->exitStatus = (*start) (arg);    } -  _pthread_catch (Pthread_exception_cancel) +  catch (Pthread_exception_cancel)      {        /*         * Thread was cancelled.         */        status = self->exitStatus = PTHREAD_CANCELED;      } -  _pthread_catch (Pthread_exception_exit) +  catch (Pthread_exception_exit)      {        /*         * Thread was exited via pthread_exit().         */        status = self->exitStatus;      } -  _pthread_catch (...) +  catch (...)      {        /*         * A system unexpected exception had occurred running the user's @@ -548,7 +548,7 @@ _pthread_callUserDestroyRoutines (pthread_t thread)  			 */  			(*(k->destructor)) (value);  		      } -		      _pthread__except (EXCEPTION_EXECUTE_HANDLER) +		      __except (EXCEPTION_EXECUTE_HANDLER)  		      {  			/*  			 * A system unexpected exception had occurred @@ -567,7 +567,7 @@ _pthread_callUserDestroyRoutines (pthread_t thread)  			 */  			(*(k->destructor)) (value);  		      } -		      _pthread_catch (...) +		      catch (...)  		      {  			/*  			 * A system unexpected exception had occurred diff --git a/tests/ChangeLog b/tests/ChangeLog index 3a18a5b..7d7cd4a 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,23 @@ +2000-08-10  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* eyal1.c (main): Change implicit cast to explicit +	cast when passing "print_server" function pointer; +	G++ no longer allows implicit func parameter casts. + +	* cleanup1.c: Remove unused "waitLock". +	(main): Fix implicit parameter cast. + +	* cancel2.c (main): Fix implicit parameter cast. + +	* cancel4.c (main): Fix implicit parameter cast. + +	* cancel3.c (main): Fix implicit parameter cast. + +	* GNUmakefile: Renamed from Makefile; Add missing +	cancel1 and cancel2 test targets. + +	* Makefile: Converted for use with MS nmake. +  2000-08-06  Ross Johnson  <rpj@special.ise.canberra.edu.au>  	* ccl.bat: Add /nologo to remove extraneous output. diff --git a/tests/GNUmakefile b/tests/GNUmakefile index e1e5ae6..3d86a0f 100644 --- a/tests/GNUmakefile +++ b/tests/GNUmakefile @@ -1,115 +1,117 @@ -# Makefile for the pthreads test suite.
 -# If all of the .pass files can be created, the test suite has passed.
 -
 -
 -CP	= copy
 -RM	= erase
 -MKDIR	= mkdir
 -TOUCH	= echo Passed >
 -ECHO	= @echo
 -
 -#
 -# Mingw32
 -#
 -GLANG   = c++
 -CC	= gcc
 -CFLAGS	= -g -O2 -mthreads -UNDEBUG -Wall -x $(GLANG)
 -BUILD_DIR	= ..
 -INCLUDES	= -I.
 -LIBS	= -L. -lpthread32
 -
 -HDR	= pthread.h semaphore.h sched.h
 -LIB	= libpthread32.a
 -DLL	= pthread.dll
 -
 -COPYFILES	= $(HDR) $(LIB) $(DLL)
 -
 -# If a test case returns a non-zero exit code to the shell, make will
 -# stop.
 -
 -TESTS	= loadfree \
 -	  mutex1 condvar1 condvar2 exit1 create1 equal1 \
 -	  exit2 exit3 \
 -	  join0 join1 join2 mutex2 mutex3 \
 -	  count1 once1 tsd1 self1 self2 cancel1 eyal1 \
 -	  condvar3 condvar4 condvar5 condvar6 condvar7 condvar8 condvar9 \
 -	  errno1 \
 -	  rwlock1 rwlock2 rwlock3 rwlock4 rwlock5 rwlock6 \
 -	  context1 cancel3 cancel4 cleanup1 cleanup2 cleanup3 \
 -	  exception1
 -
 -PASSES	= $(TESTS:%=%.pass)
 -
 -all:	$(PASSES)
 -	@ $(ECHO) ALL TESTS PASSED! Congratulations!
 -
 -loadfree.pass:
 -mutex1.pass:
 -mutex2.pass:
 -exit1.pass:
 -condvar1.pass:
 -self1.pass:
 -condvar2.pass: condvar1.pass
 -create1.pass: mutex2.pass
 -mutex3.pass: create1.pass
 -equal1.pass: create1.pass
 -exit2.pass: create1.pass
 -exit3.pass: create1.pass
 -join0.pass: create1.pass
 -join1.pass: create1.pass
 -join2.pass: create1.pass
 -count1.pass: join1.pass
 -once1.pass: create1.pass
 -tsd1.pass: join1.pass
 -self2.pass: create1.pass
 -eyal1.pass: tsd1.pass
 -condvar3.pass: create1.pass
 -condvar4.pass: create1.pass
 -condvar5.pass: condvar4.pass
 -condvar6.pass: condvar5.pass
 -condvar7.pass: condvar6.pass cleanup1.pass
 -condvar8.pass: condvar7.pass
 -condvar9.pass: condvar8.pass
 -errno1.pass: mutex3.pass
 -rwlock1.pass: condvar6.pass
 -rwlock2.pass: rwlock1.pass
 -rwlock3.pass: rwlock2.pass
 -rwlock4.pass: rwlock3.pass
 -rwlock5.pass: rwlock4.pass
 -rwlock6.pass: rwlock5.pass
 -context1.pass: cancel2.pass
 -cancel3.pass: context1.pass
 -cancel4.pass: cancel3.pass
 -cleanup1.pass: cancel4.pass
 -cleanup2.pass: cleanup1.pass
 -cleanup3.pass: cleanup2.pass
 -exception1.pass: cancel4.pass
 -
 -%.pass: %.exe $(LIB) $(DLL) $(HDR)
 -	$*
 -	@ $(ECHO) Passed
 -	@ $(TOUCH) $@
 -
 -%.exe: %.c
 -	@ $(CC) $(CFLAGS) -o $@ $^ $(INCLUDES) $(LIBS)
 -
 -%.pre: %.c
 -	@ $(CC) -E $(CFLAGS) -o $@ $^ $(INCLUDES)
 -
 -%.s: %.c
 -	@ $(CC) -S $(CFLAGS) -o $@ $^ $(INCLUDES)
 -
 -$(COPYFILES):
 -	@ $(ECHO) Copying $@
 -	@ $(CP) $(BUILD_DIR)\$@ .
 -
 -clean:
 -	- $(RM) *.dll
 -	- $(RM) pthread.h
 -	- $(RM) semaphore.h
 -	- $(RM) sched.h
 -	- $(RM) *.a
 -	- $(RM) *.e
 -	- $(RM) *.exe
 -	- $(RM) *.pass
 -
 +# Makefile for the pthreads test suite. +# If all of the .pass files can be created, the test suite has passed. + + +CP	= copy +RM	= erase +MKDIR	= mkdir +TOUCH	= echo Passed > +ECHO	= @echo + +# +# Mingw32 +# +GLANG   = c++ +CC	= gcc +CFLAGS	= -g -O2 -mthreads -UNDEBUG -Wall -x $(GLANG) +BUILD_DIR	= .. +INCLUDES	= -I. +LIBS	= -L. -lpthread32 + +HDR	= pthread.h semaphore.h sched.h +LIB	= libpthread32.a +DLL	= pthread.dll + +COPYFILES	= $(HDR) $(LIB) $(DLL) + +# If a test case returns a non-zero exit code to the shell, make will +# stop. + +TESTS	= loadfree \ +	  mutex1 condvar1 condvar2 exit1 create1 equal1 \ +	  exit2 exit3 \ +	  join0 join1 join2 mutex2 mutex3 \ +	  count1 once1 tsd1 self1 self2 cancel1 cancel2 eyal1 \ +	  condvar3 condvar4 condvar5 condvar6 condvar7 condvar8 condvar9 \ +	  errno1 \ +	  rwlock1 rwlock2 rwlock3 rwlock4 rwlock5 rwlock6 \ +	  context1 cancel3 cancel4 cleanup1 cleanup2 cleanup3 \ +	  exception1 + +PASSES	= $(TESTS:%=%.pass) + +all:	$(PASSES) +	@ $(ECHO) ALL TESTS PASSED! Congratulations! + +loadfree.pass: +mutex1.pass: +mutex2.pass: +exit1.pass: +condvar1.pass: +self1.pass: +condvar2.pass: condvar1.pass +create1.pass: mutex2.pass +cancel1.pass: create1.pass +cancel2.pass: cancel1.pass +mutex3.pass: create1.pass +equal1.pass: create1.pass +exit2.pass: create1.pass +exit3.pass: create1.pass +join0.pass: create1.pass +join1.pass: create1.pass +join2.pass: create1.pass +count1.pass: join1.pass +once1.pass: create1.pass +tsd1.pass: join1.pass +self2.pass: create1.pass +eyal1.pass: tsd1.pass +condvar3.pass: create1.pass +condvar4.pass: create1.pass +condvar5.pass: condvar4.pass +condvar6.pass: condvar5.pass +condvar7.pass: condvar6.pass cleanup1.pass +condvar8.pass: condvar7.pass +condvar9.pass: condvar8.pass +errno1.pass: mutex3.pass +rwlock1.pass: condvar6.pass +rwlock2.pass: rwlock1.pass +rwlock3.pass: rwlock2.pass +rwlock4.pass: rwlock3.pass +rwlock5.pass: rwlock4.pass +rwlock6.pass: rwlock5.pass +context1.pass: cancel2.pass +cancel3.pass: context1.pass +cancel4.pass: cancel3.pass +cleanup1.pass: cancel4.pass +cleanup2.pass: cleanup1.pass +cleanup3.pass: cleanup2.pass +exception1.pass: cancel4.pass + +%.pass: %.exe $(LIB) $(DLL) $(HDR) +	$* +	@ $(ECHO) Passed +	@ $(TOUCH) $@ + +%.exe: %.c +	@ $(CC) $(CFLAGS) -o $@ $^ $(INCLUDES) $(LIBS) + +%.pre: %.c +	@ $(CC) -E $(CFLAGS) -o $@ $^ $(INCLUDES) + +%.s: %.c +	@ $(CC) -S $(CFLAGS) -o $@ $^ $(INCLUDES) + +$(COPYFILES): +	@ $(ECHO) Copying $@ +	@ $(CP) $(BUILD_DIR)\$@ . + +clean: +	- $(RM) *.dll +	- $(RM) pthread.h +	- $(RM) semaphore.h +	- $(RM) sched.h +	- $(RM) *.a +	- $(RM) *.e +	- $(RM) *.exe +	- $(RM) *.pass + diff --git a/tests/Makefile b/tests/Makefile index 0775ea3..8143b46 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -8,93 +8,97 @@ MKDIR	= mkdir  TOUCH	= echo Passed >
  ECHO	= @echo
 -#
 -# Mingw32
 -#
 -GLANG   = c++
 -CC	= gcc
 -CFLAGS	= -g -O2 -UNDEBUG -Wall -x $(GLANG)
 -BUILD_DIR	= ..
 -INCLUDES	= -I.
 -LIBS	= -L. -lpthread32
 +CPHDR	= pthread.h semaphore.h sched.h
 +CPLIB	= pthread.lib
 +CPDLL	= pthread.dll
 -HDR	= pthread.h semaphore.h sched.h
 -LIB	= libpthread32.a
 -DLL	= pthread.dll
 +CFLAGS= /W3 /MT /nologo /Yd /Zi -D_WIN32_WINNT=0x400 -DSTDCALL=_stdcall
 +LFLAGS= /INCREMENTAL:NO
 +LIBS	= .\pthread.lib
 +INCLUDES=-I.
 +BUILD_DIR=..
 -COPYFILES	= $(HDR) $(LIB) $(DLL)
 +COPYFILES	= $(CPHDR) $(CPLIB) $(CPDLL)
  # If a test case returns a non-zero exit code to the shell, make will
  # stop.
 -TESTS	= loadfree \
 -	  mutex1 condvar1 condvar2 exit1 create1 equal1 \
 -	  exit2 exit3 \
 -	  join0 join1 join2 mutex2 mutex3 \
 -	  count1 once1 tsd1 self1 self2 cancel1 eyal1 \
 -	  condvar3 condvar4 condvar5 condvar6 condvar7 condvar8 condvar9 \
 -	  errno1 \
 -	  rwlock1 rwlock2 rwlock3 rwlock4 rwlock5 rwlock6 \
 -	  context1 cancel3 cancel4 cleanup1 cleanup2 cleanup3 \
 -	  exception1
 -
 -PASSES	= $(TESTS:%=%.pass)
 -
 -all:	$(PASSES)
 +PASSES= loadfree.pass \
 +	  mutex1.pass  condvar1.pass  condvar2.pass  \
 +	  exit1.pass  create1.pass  equal1.pass  \
 +	  exit2.pass  exit3.pass  \
 +	  join0.pass  join1.pass  join2.pass  \
 +	  mutex2.pass  mutex3.pass  \
 +	  count1.pass  once1.pass  tsd1.pass  \
 +	  self1.pass  self2.pass  \
 +	  cancel1.pass  cancel2.pass  \
 +	  eyal1.pass  \
 +	  condvar3.pass  condvar4.pass  condvar5.pass  condvar6.pass  \
 +	  condvar7.pass  condvar8.pass  condvar9.pass  \
 +	  errno1.pass  \
 +	  rwlock1.pass  rwlock2.pass  rwlock3.pass  rwlock4.pass  rwlock5.pass  rwlock6.pass  \
 +	  context1.pass  \
 +	  cancel3.pass  cancel4.pass  cleanup1.pass  \
 +	  cleanup2.pass  cleanup3.pass  \
 +	  exception1.pass 
 +
 +all:	$(CPLIB) $(CPDLL) $(CPHDR) $(PASSES)
  	@ $(ECHO) ALL TESTS PASSED! Congratulations!
 -loadfree.pass:
 -mutex1.pass:
 -mutex2.pass:
 -exit1.pass:
 -condvar1.pass:
 -self1.pass:
 -condvar2.pass: condvar1.pass
 -create1.pass: mutex2.pass
 -mutex3.pass: create1.pass
 -equal1.pass: create1.pass
 -exit2.pass: create1.pass
 -exit3.pass: create1.pass
 -join0.pass: create1.pass
 -join1.pass: create1.pass
 -join2.pass: create1.pass
 -count1.pass: join1.pass
 -once1.pass: create1.pass
 -tsd1.pass: join1.pass
 -self2.pass: create1.pass
 -eyal1.pass: tsd1.pass
 -condvar3.pass: create1.pass
 -condvar4.pass: create1.pass
 -condvar5.pass: condvar4.pass
 -condvar6.pass: condvar5.pass
 -condvar7.pass: condvar6.pass cleanup1.pass
 -condvar8.pass: condvar7.pass
 -condvar9.pass: condvar8.pass
 -errno1.pass: mutex3.pass
 -rwlock1.pass: condvar6.pass
 -rwlock2.pass: rwlock1.pass
 -rwlock3.pass: rwlock2.pass
 -rwlock4.pass: rwlock3.pass
 -rwlock5.pass: rwlock4.pass
 -rwlock6.pass: rwlock5.pass
 -context1.pass: cancel2.pass
 -cancel3.pass: context1.pass
 -cancel4.pass: cancel3.pass
 -cleanup1.pass: cancel4.pass
 -cleanup2.pass: cleanup1.pass
 -cleanup3.pass: cleanup2.pass
 -exception1.pass: cancel4.pass
 -
 -%.pass: %.exe $(LIB) $(DLL) $(HDR)
 -	$*
 +loadfree.pass: loadfree.exe
 +mutex1.pass: mutex1.exe
 +mutex2.pass: mutex2.exe
 +exit1.pass: exit1.exe
 +condvar1.pass: condvar1.exe
 +self1.pass: self1.exe
 +condvar2.pass: condvar2.exe condvar1.pass
 +create1.pass: create1.exe mutex2.pass
 +cancel1.pass: cancel1.exe create1.pass
 +cancel2.pass: cancel2.exe cancel1.pass
 +mutex3.pass: mutex3.exe create1.pass
 +equal1.pass: equal1.exe create1.pass
 +exit2.pass: exit2.exe create1.pass
 +exit3.pass: exit3.exe create1.pass
 +join0.pass: join0.exe create1.pass
 +join1.pass: join1.exe create1.pass
 +join2.pass: join2.exe create1.pass
 +count1.pass: count1.exe join1.pass
 +once1.pass: once1.exe create1.pass
 +tsd1.pass: tsd1.exe join1.pass
 +self2.pass: self2.exe create1.pass
 +eyal1.pass: eyal1.exe tsd1.pass
 +condvar3.pass: condvar3.exe create1.pass
 +condvar4.pass: condvar4.exe create1.pass
 +condvar5.pass: condvar5.exe condvar4.pass
 +condvar6.pass: condvar6.exe condvar5.pass
 +condvar7.pass: condvar7.exe condvar6.pass cleanup1.pass
 +condvar8.pass: condvar8.exe condvar7.pass
 +condvar9.pass: condvar9.exe condvar8.pass
 +errno1.pass: errno1.exe mutex3.pass
 +rwlock1.pass: rwlock1.exe condvar6.pass
 +rwlock2.pass: rwlock2.exe rwlock1.pass
 +rwlock3.pass: rwlock3.exe rwlock2.pass
 +rwlock4.pass: rwlock4.exe rwlock3.pass
 +rwlock5.pass: rwlock5.exe rwlock4.pass
 +rwlock6.pass: rwlock6.exe rwlock5.pass
 +context1.pass: context1.exe cancel2.pass
 +cancel3.pass: cancel3.exe context1.pass
 +cancel4.pass: cancel4.exe cancel3.pass
 +cleanup1.pass: cleanup1.exe cancel4.pass
 +cleanup2.pass: cleanup2.exe cleanup1.pass
 +cleanup3.pass: cleanup3.exe cleanup2.pass
 +exception1.pass: exception1.exe cancel4.pass
 +
 +$(PASSES): $*.exe
 +	@ .\$*.exe
  	@ $(ECHO) Passed
 -	@ $(TOUCH) $@
 +	@ $(TOUCH) $*.pass
 -%.exe: %.c
 -	@ $(CC) $(CFLAGS) -o $@ $^ $(INCLUDES) $(LIBS)
 +.c.exe:
 +	@ $(CC) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(LIBS)
 -%.pre: %.c
 -	@ $(CC) -E $(CFLAGS) -o $@ $^ $(INCLUDES)
 +.c.pre:
 +	@ $(CC) /E $(CFLAGS) $(INCLUDES) /Fe$@ $<
  $(COPYFILES):
  	@ $(ECHO) Copying $@
 @@ -105,8 +109,11 @@ clean:  	- $(RM) pthread.h
  	- $(RM) semaphore.h
  	- $(RM) sched.h
 -	- $(RM) *.a
 +	- $(RM) *.lib
  	- $(RM) *.e
 +	- $(RM) *.obj
 +	- $(RM) *.pdb
 +	- $(RM) *.o
  	- $(RM) *.exe
  	- $(RM) *.pass
 diff --git a/tests/cancel2.c b/tests/cancel2.c index b09eab9..f64882a 100644 --- a/tests/cancel2.c +++ b/tests/cancel2.c @@ -187,7 +187,7 @@ main()        int fail = 0;        int result = 0; -      assert(pthread_join(t[i], (void *) &result) == 0); +      assert(pthread_join(t[i], (void **) &result) == 0);        fail = (result != (int) PTHREAD_CANCELED);        if (fail)  	{ diff --git a/tests/cancel3.c b/tests/cancel3.c index cb6f3d2..e2ffc2b 100644 --- a/tests/cancel3.c +++ b/tests/cancel3.c @@ -147,7 +147,7 @@ main()         * a return value of PTHREAD_CANCELED confirms that async         * cancelation succeeded.         */ -      assert(pthread_join(t[i], (void *) &result) == 0); +      assert(pthread_join(t[i], (void **) &result) == 0);        fail = (result != (int) PTHREAD_CANCELED); diff --git a/tests/cancel4.c b/tests/cancel4.c index f63241f..d4b058c 100644 --- a/tests/cancel4.c +++ b/tests/cancel4.c @@ -150,7 +150,7 @@ main()         * a return value of PTHREAD_CANCELED indicates that async         * cancelation occurred.         */ -      assert(pthread_join(t[i], (void *) &result) == 0); +      assert(pthread_join(t[i], (void **) &result) == 0);        fail = (result == (int) PTHREAD_CANCELED); diff --git a/tests/cleanup1.c b/tests/cleanup1.c index 2be711c..2c8e9a6 100644 --- a/tests/cleanup1.c +++ b/tests/cleanup1.c @@ -60,8 +60,6 @@ struct bag_t_ {  static bag_t threadbag[NUMTHREADS + 1]; -static pthread_mutex_t waitLock = PTHREAD_MUTEX_INITIALIZER; -  static int pop_count = 0;  static void @@ -155,7 +153,7 @@ main()        int fail = 0;        int result = 0; -      assert(pthread_join(t[i], (void *) &result) == 0); +      assert(pthread_join(t[i], (void **) &result) == 0);        fail = (result != (int) PTHREAD_CANCELED); diff --git a/tests/eyal1.c b/tests/eyal1.c index 849e632..412fbf0 100644 --- a/tests/eyal1.c +++ b/tests/eyal1.c @@ -244,14 +244,14 @@ main (int argc, char *argv[])        assert(pthread_mutex_init (&tcs[i].mutex_end, NULL) == 0);        assert(pthread_mutex_init (&tcs[i].mutex_ended, NULL) == 0); -      tcs[i].work = 0; +      tcs[i].work = 0;          assert(pthread_mutex_lock (&tcs[i].mutex_start) == 0);        assert((tcs[i].stat =   	      pthread_create (&tcs[i].thread,  			      NULL, -			      (void*)&print_server, -				(void *)&tcs[i]) +                  (void *(*)(void *))&print_server, +                (void *) &tcs[i])  	      ) == 0);        /*  | 
