diff options
-rw-r--r-- | ANNOUNCE | 2 | ||||
-rw-r--r-- | ChangeLog | 642 | ||||
-rw-r--r-- | FAQ | 2 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | WinCE-PORT | 16 | ||||
-rw-r--r-- | buildlib.bat | 2 | ||||
-rw-r--r-- | cancel.c | 24 | ||||
-rw-r--r-- | cleanup.c | 18 | ||||
-rw-r--r-- | condvar.c | 14 | ||||
-rw-r--r-- | create.c | 8 | ||||
-rw-r--r-- | dll.c | 40 | ||||
-rw-r--r-- | exit.c | 8 | ||||
-rw-r--r-- | global.c | 12 | ||||
-rw-r--r-- | implement.h | 42 | ||||
-rw-r--r-- | misc.c | 12 | ||||
-rw-r--r-- | mutex.c | 12 | ||||
-rw-r--r-- | private.c | 92 | ||||
-rw-r--r-- | pthread.def | 6 | ||||
-rw-r--r-- | pthread.h | 18 | ||||
-rw-r--r-- | rwlock.c | 8 | ||||
-rw-r--r-- | semaphore.c | 4 | ||||
-rw-r--r-- | sync.c | 4 | ||||
-rw-r--r-- | tsd.c | 8 |
23 files changed, 501 insertions, 495 deletions
@@ -50,7 +50,7 @@ Known bugs in this snapshot 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().
+end of the try block in ptw32_threadStart().
2. There are problems using the libpthreadw32.a stub archive derived
from either of pthreadVSE.dll or pthreadVCE.dll. The cleanup1.c test
@@ -1,5 +1,11 @@ 2000-08-17 Ross Johnson <rpj@special.ise.canberra.edu.au> + * All applicable: Change _pthread_ prefix to + ptw32_ prefix to remove leading underscores + from private library identifiers (single + and double leading underscores are reserved in the + ANSI C standard for compiler implementations). + * tsd.c (pthread_create_key): Initialise temporary key before returning it's address to avoid race conditions. @@ -66,18 +72,18 @@ * 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 + now simply undefines ptw32__except and + ptw32_catch if defined; VC++ was not textually + substituting ptw32_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. + * private.c (ptw32_threadStart): Ditto. + (ptw32_callUserDestroyRoutines): Ditto. - * implement.h (_pthread__except): Remove #define. - (_pthread_catch): Remove #define. + * implement.h (ptw32__except): Remove #define. + (ptw32_catch): Remove #define. * GNUmakefile (pthread.a): New target to build libpthread32.a from pthread.dll using dlltool. @@ -133,24 +139,24 @@ a local copy of the handle for internal use until pthread_create returns. - * private.c (_pthread_threadStart): Initialise ei[]. - (_pthread_threadStart): When beginthread is used to start the + * private.c (ptw32_threadStart): Initialise ei[]. + (ptw32_threadStart): When beginthread is used to start the thread, force waiting until the creator thread had the thread handle. - * cancel.c (_pthread_cancel_thread): Include context switch + * cancel.c (ptw32_cancel_thread): Include context switch code for defined(_X86_) environments in addition to _M_IX86. * rwlock.c (pthread_rwlock_destroy): Assignment changed to avoid compiler warning. - * private.c (_pthread_get_exception_services_code): Cast + * private.c (ptw32_get_exception_services_code): Cast NULL return value to avoid compiler warning. * cleanup.c (pthread_pop_cleanup): Initialise "cleanup" variable to avoid compiler warnings. - * misc.c (_pthread_new): Change "new" variable to "t" to avoid + * misc.c (ptw32_new): Change "new" variable to "t" to avoid confusion with the C++ keyword of the same name. * condvar.c (cond_wait_cleanup): Initialise lastWaiter variable. @@ -234,10 +240,10 @@ * implement.h: Include SEH code only if MSC is not compiling as C++. - * cancel.c (_pthread_cancel_thread): Add _M_IX86 check. + * cancel.c (ptw32_cancel_thread): Add _M_IX86 check. (pthread_testcancel): Include SEH code only if MSC is not compiling as C++. - (_pthread_cancel_self): Include SEH code only if MSC is not + (ptw32_cancel_self): Include SEH code only if MSC is not compiling as C++. 2000-01-06 Ross Johnson <rpj@special.ise.canberra.edu.au> @@ -247,38 +253,38 @@ 2000-01-04 Ross Johnson <rpj@special.ise.canberra.edu.au> - * private.c (_pthread_get_exception_services_code): New; returns + * private.c (ptw32_get_exception_services_code): New; returns value of EXCEPTION_PTHREAD_SERVICES. - (_pthread_processInitialize): Remove initialisation of - _pthread_exception_services which is no longer needed. + (ptw32_processInitialize): Remove initialisation of + ptw32_exception_services which is no longer needed. - * pthread.h (_pthread_exception_services): Remove extern. - (_pthread_get_exception_services_code): Add function prototype; + * pthread.h (ptw32_exception_services): Remove extern. + (ptw32_get_exception_services_code): Add function prototype; use this to return EXCEPTION_PTHREAD_SERVICES value instead of - using the _pthread_exception_services variable which I had + using the ptw32_exception_services variable which I had trouble exporting through pthread.def. - * global.c (_pthread_exception_services): Remove declaration. + * global.c (ptw32_exception_services): Remove declaration. 1999-11-22 Ross Johnson <rpj@special.ise.canberra.edu.au> - * implement.h: Forward declare _pthread_new(); + * implement.h: Forward declare ptw32_new(); - * misc.c (_pthread_new): New; alloc and initialise a new pthread_t. + * misc.c (ptw32_new): New; alloc and initialise a new pthread_t. (pthread_self): New thread struct is generated by new routine - _pthread_new(). + ptw32_new(). * create.c (pthread_create): New thread struct is generated - by new routine_pthread_new(). + by new routine ptw32_new(). 1999-11-21 Ross Johnson <rpj@special.ise.canberra.edu.au> - * global.c (_pthread_exception_services): Declare new variable. + * global.c (ptw32_exception_services): Declare new variable. - * private.c (_pthread_threadStart): Destroy thread's + * private.c (ptw32_threadStart): Destroy thread's cancelLock mutex; make 'catch' and '__except' usageimmune to redfinitions in pthread.h. - (_pthread_processInitialize): Init new constant _pthread_exception_services. + (ptw32_processInitialize): Init new constant ptw32_exception_services. * create.c (pthread_create): Initialise thread's cancelLock mutex. @@ -292,15 +298,15 @@ won't catch our internal exceptions. (__except): ditto for __except. - * implement.h (_pthread_catch): Define internal version + * implement.h (ptw32_catch): Define internal version of 'catch' because 'catch' is redefined by pthread.h. (__except): ditto for __except. (struct pthread_t_): Add cancelLock mutex for async cancel safety. - * cancel.c (_pthread_cancel_self): New; part of the async + * cancel.c (ptw32_cancel_self): New; part of the async cancellation implementation. - (_pthread_cancel_thread): Ditto; this function is X86 + (ptw32_cancel_thread): Ditto; this function is X86 processor specific. (pthread_setcancelstate): Add check for pending async cancel request and cancel the calling thread if @@ -421,9 +427,9 @@ Sat Sep 10 12:56:13 1999 Ross Johnson <rpj@swan.canberra.edu.au> Add rwlock function prototypes. * rwlock.c: New module. * pthread.def: Add new rwlock functions. - * private.c (_pthread_processInitialize): initialise - _pthread_rwlock_test_init_lock critical section. - * global.c (_pthread_rwlock_test_init_lock): Add. + * private.c (ptw32_processInitialize): initialise + ptw32_rwlock_test_init_lock critical section. + * global.c (ptw32_rwlock_test_init_lock): Add. * mutex.c (pthread_mutex_destroy): Don't free mutex memory if mutex is PTHREAD_MUTEX_INITIALIZER and has not been @@ -441,13 +447,13 @@ Wed Sep 8 12:56:13 1999 Ross Johnson <rpj@swan.canberra.edu.au> 1999-08-21 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * private.c (_pthread_threadStart): Apply fix of 1999-08-19 + * private.c (ptw32_threadStart): Apply fix of 1999-08-19 this time to C++ and non-trapped C versions. Ommitted to do this the first time through. 1999-08-19 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * private.c (_pthread_threadStart): Return exit status from + * private.c (ptw32_threadStart): Return exit status from the application thread startup routine. - Milan Gardian <mg@tatramed.sk> @@ -455,7 +461,7 @@ Wed Sep 8 12:56:13 1999 Ross Johnson <rpj@swan.canberra.edu.au> * exit.c (pthread_exit): Put status into pthread_t->exitStatus - John Bossom <john.Bossom@cognos.com> - * private.c (_pthread_threadStart): Set pthread->exitStatus + * private.c (ptw32_threadStart): Set pthread->exitStatus on exit of try{} block. - John Bossom <john.Bossom@cognos.com> * sync.c (pthread_join): use pthread_exitStatus value if the @@ -467,8 +473,8 @@ Tue Aug 17 20:17:58 CDT 1999 Mumit Khan <khan@xraylith.wisc.edu> * create.c (pthread_create): Add CRTDLL suppport. * exit.c (pthread_exit): Likewise. - * private.c (_pthread_threadStart): Likewise. - (_pthread_threadDestroy): Likewise. + * private.c (ptw32_threadStart): Likewise. + (ptw32_threadDestroy): Likewise. * sync.c (pthread_join): Likewise. * tests/join1.c (main): Warn about partial support for CRTDLL. @@ -481,8 +487,8 @@ Tue Aug 17 20:00:08 1999 Mumit Khan <khan@xraylith.wisc.edu> * errno.c (_errno): Fix self type. * pthread.h (PT_STDCALL): Move from here to * implement.h (PT_STDCALL): here. - (_pthread_threadStart): Fix prototype. - * private.c (_pthread_threadStart): Likewise. + (ptw32_threadStart): Fix prototype. + * private.c (ptw32_threadStart): Likewise. 1999-08-14 Ross Johnson <rpj@ixobrychus.canberra.edu.au> @@ -491,7 +497,7 @@ Tue Aug 17 20:00:08 1999 Mumit Khan <khan@xraylith.wisc.edu> 1999-08-12 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * private.c (_pthread_threadStart): ei[] only declared if _MSC_VER. + * private.c (ptw32_threadStart): ei[] only declared if _MSC_VER. * exit.c (pthread_exit): Check for implicitly created threads to avoid raising an unhandled exception. @@ -525,10 +531,10 @@ Tue Aug 17 20:00:08 1999 Mumit Khan <khan@xraylith.wisc.edu> Pthread_exception_cancel (C++) used to identify the exception. * exit.c (pthread_exit): throw/raise an exception to return to - _pthread_threadStart() to exit the thread. _PTHREAD_EPS_EXIT (SEH) + ptw32_threadStart() to exit the thread. _PTHREAD_EPS_EXIT (SEH) and Pthread_exception_exit (C++) used to identify the exception. - * private.c (_pthread_threadStart): Add pthread_exit exception trap; + * private.c (ptw32_threadStart): Add pthread_exit exception trap; clean up and exit the thread directly rather than via pthread_exit(). Sun May 30 00:25:02 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> @@ -596,8 +602,8 @@ Sun Apr 4 11:05:57 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * sched.c (sched_yield): New function. - * condvar.c (_pthread_sem_*): Rename to sem_*; except for - _pthread_sem_timedwait which is an private function. + * condvar.c (ptw32_sem_*): Rename to sem_*; except for + ptw32_sem_timedwait which is an private function. Sat Apr 3 23:28:00 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> @@ -605,21 +611,21 @@ Sat Apr 3 23:28:00 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Fri Apr 2 11:08:50 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * implement.h (_pthread_sem_*): Remove prototypes now defined in + * implement.h (ptw32_sem_*): Remove prototypes now defined in semaphore.h. * pthread.h (sempahore.h): Include. * semaphore.h: New file for POSIX 1b semaphores. - * pthread.h (_pthread_sem_t): Change to sem_t. + * pthread.h (ptw32_sem_t): Change to sem_t. - * semaphore.c (_pthread_sem_*): Change to sem_*; these functions + * semaphore.c (ptw32_sem_*): Change to sem_*; these functions will be exported from the library; set errno on error. - John Bossom <jebossom@cognos.com> - (_pthread_sem_timedwait): Moved to private.c. + (ptw32_sem_timedwait): Moved to private.c. - * private.c (_pthread_sem_timedwait): Moved from semaphore.c; + * private.c (ptw32_sem_timedwait): Moved from semaphore.c; set errno on error. * errno.c (_errno): New file. New function. @@ -629,7 +635,7 @@ Fri Apr 2 11:08:50 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Fri Mar 26 14:11:45 1999 Ross Johnson <rpj@swan.canberra.edu.au> - * semaphore.c (_pthread_sem_timedwait): Check for negative + * semaphore.c (ptw32_sem_timedwait): Check for negative milliseconds. - Tor Lillqvist <tml@iki.fi> @@ -645,7 +651,7 @@ Wed Mar 24 11:32:07 1999 Ross Johnson <rpj@swan.canberra.edu.au> * implement.h (SE_INFORMATION): Fix values. - John Bossom <jebossom@cognos.com> - * private.c (_pthread_threadDestroy): Close the thread handle. + * private.c (ptw32_threadDestroy): Close the thread handle. - John Bossom <jebossom@cognos.com> Fri Mar 19 12:57:27 1999 Ross Johnson <rpj@swan.canberra.edu.au> @@ -654,7 +660,7 @@ Fri Mar 19 12:57:27 1999 Ross Johnson <rpj@swan.canberra.edu.au> Fri Mar 19 09:12:59 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * private.c (_pthread_threadStart): status returns PTHREAD_CANCELED. + * private.c (ptw32_threadStart): status returns PTHREAD_CANCELED. * pthread.h (PTHREAD_CANCELED): defined. @@ -705,7 +711,7 @@ Mon Mar 8 11:18:59 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> problem of initialising the opaque critical section element in it. (PTHREAD_COND_INITIALIZER): Ditto. - * semaphore.c (_pthread_sem_timedwait): Check sem == NULL earlier. + * semaphore.c (ptw32_sem_timedwait): Check sem == NULL earlier. Sun Mar 7 12:31:14 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> @@ -717,11 +723,11 @@ Sun Mar 7 12:31:14 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> the cancel event is recognised and acted apon if both objects happen to be signaled together. - * private.c (_pthread_cond_test_init_lock): Initialise and destroy. + * private.c (ptw32_cond_test_init_lock): Initialise and destroy. - * implement.h (_pthread_cond_test_init_lock): Add extern. + * implement.h (ptw32_cond_test_init_lock): Add extern. - * global.c (_pthread_cond_test_init_lock): Add declaration. + * global.c (ptw32_cond_test_init_lock): Add declaration. * condvar.c (pthread_cond_destroy): check for valid initialised CV; flag destroyed CVs as invalid. @@ -761,7 +767,7 @@ Sat Feb 20 16:03:30 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * dll.c (DLLMain): Expand TryEnterCriticalSection support test. * mutex.c (pthread_mutex_trylock): The check for - _pthread_try_enter_critical_section == NULL should have been + ptw32_try_enter_critical_section == NULL should have been removed long ago. Fri Feb 19 16:03:30 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> @@ -824,7 +830,7 @@ Thu Feb 4 10:07:28 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Wed Feb 3 13:04:44 1999 Ross Johnson <rpj@swan.canberra.edu.au> - * cleanup.c: Rename _pthread_*_cleanup() to pthread_*_cleanup(). + * cleanup.c: Rename ptw32_*_cleanup() to pthread_*_cleanup(). * pthread.def: Ditto. @@ -844,7 +850,7 @@ Wed Feb 3 10:13:48 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Tue Feb 2 18:07:43 1999 Ross Johnson <rpj@swan.canberra.edu.au> * implement.h: Add #include <pthread.h>. - Change sem_t to _pthread_sem_t. + Change sem_t to ptw32_sem_t. Various patches by Kevin Ruland <Kevin.Ruland@anheuser-busch.com> @@ -860,7 +866,7 @@ Tue Feb 2 18:07:43 1999 Ross Johnson <rpj@swan.canberra.edu.au> * create.c (pthread_create): Set sigmask in thread. - * condvar.c: Remove #include. Change sem_* to _pthread_sem_*. + * condvar.c: Remove #include. Change sem_* to ptw32_sem_*. * attr.c: Changed #include. @@ -871,8 +877,8 @@ Fri Jan 29 11:56:28 1999 Ross Johnson <rpj@swan.canberra.edu.au> * Makefile.in (OBJS): Add semaphore.o to list. - * semaphore.c (_pthread_sem_timedwait): Move from private.c. - Rename sem_* to _pthread_sem_*. + * semaphore.c (ptw32_sem_timedwait): Move from private.c. + Rename sem_* to ptw32_sem_*. * pthread.h (pthread_cond_t): Change type of sem_t. _POSIX_SEMAPHORES no longer defined. @@ -880,12 +886,12 @@ Fri Jan 29 11:56:28 1999 Ross Johnson <rpj@swan.canberra.edu.au> * semaphore.h: Contents moved to implement.h. Removed from source tree. - * implement.h: Add semaphore function prototypes and ename all - functions to prepend '_pthread_'. They are + * implement.h: Add semaphore function prototypes and rename all + functions to prepend 'ptw32_'. They are now private to the pthreads-win32 implementation. * private.c: Change #warning. - Move _pthread_sem_timedwait() to semaphore.c. + Move ptw32_sem_timedwait() to semaphore.c. * cleanup.c: Change #warning. @@ -937,7 +943,7 @@ Fri Jan 22 14:31:59 1999 Ross Johnson <rpj@swan.canberra.edu.au> * attr.c (pthread_attr_init): Remove unused 'result'. Cast malloc return value. - * private.c (_pthread_callUserDestroyRoutines): Redo conditional + * private.c (ptw32_callUserDestroyRoutines): Redo conditional compilation. * misc.c (CancelableWait): C++ version uses 'throw'. @@ -982,7 +988,7 @@ Tue Jan 19 18:27:42 1999 Ross Johnson <rpj@swan.canberra.edu.au> (pthreadCancelableTimedWait): Just calls CancelableWait() with passed in timeout. - * private.c (_pthread_sem_timedwait): 'abstime' arg really is + * private.c (ptw32_sem_timedwait): 'abstime' arg really is absolute time. Calculate relative time to wait from current time before passing timeout to new routine pthreadCancelableTimedWait(). @@ -1020,13 +1026,13 @@ Sun Jan 17 12:01:26 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * pthread.h (PTHREAD_MUTEX_INITIALIZER): Init new 'staticinit' value to '1' and existing 'valid' value to '1'. - * global.c (_pthread_mutex_test_init_lock): Add. + * global.c (ptw32_mutex_test_init_lock): Add. - * implement.h (_pthread_mutex_test_init_lock.): Add extern. + * implement.h (ptw32_mutex_test_init_lock.): Add extern. - * private.c (_pthread_processInitialize): Init critical section for + * private.c (ptw32_processInitialize): Init critical section for global lock used by _mutex_check_need_init(). - (_pthread_processTerminate): Ditto (:s/Init/Destroy/). + (ptw32_processTerminate): Ditto (:s/Init/Destroy/). * dll.c (dllMain): Move call to FreeLibrary() so that it is only called once when the process detaches. @@ -1062,10 +1068,10 @@ Sun Jan 17 12:01:26 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Sun Jan 17 12:01:26 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * private.c (_pthread_sem_timedwait): Move from semaphore.c. + * private.c (ptw32_sem_timedwait): Move from semaphore.c. * semaphore.c : Remove redundant #includes. - (_pthread_sem_timedwait): Move to private.c. + (ptw32_sem_timedwait): Move to private.c. (sem_wait): Add missing abstime arg to pthreadCancelableWait() call. Fri Jan 15 23:38:05 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> @@ -1080,20 +1086,20 @@ Fri Jan 15 15:41:28 1999 Ross Johnson <rpj@swan.canberra.edu.au> * condvar.c (cond_timedwait): New generalised function called by both pthread_cond_wait() and pthread_cond_timedwait(). This is essentially pthread_cond_wait() renamed and modified to add the - 'abstime' arg and call the new _pthread_sem_timedwait() instead of + 'abstime' arg and call the new ptw32_sem_timedwait() instead of sem_wait(). (pthread_cond_wait): Now just calls the internal static function cond_timedwait() with an INFINITE wait. (pthread_cond_timedwait): Now implemented. Calls the internal static function cond_timedwait(). - * implement.h (_pthread_sem_timedwait): New internal function + * implement.h (ptw32_sem_timedwait): New internal function prototype. * misc.c (pthreadCancelableWait): Added new 'abstime' argument to allow shorter than INFINITE wait. - * semaphore.c (_pthread_sem_timedwait): New function for internal + * semaphore.c (ptw32_sem_timedwait): New function for internal use. This is essentially sem_wait() modified to add the 'abstime' arg and call the modified (see above) pthreadCancelableWait(). @@ -1109,11 +1115,11 @@ Thu Jan 14 14:27:13 1999 Ross Johnson <rpj@swan.canberra.edu.au> handling will not be included and thus thread cancellation, for example, will not work. - * cleanup.c (_pthread_pop_cleanup): Add #warning to compile this + * cleanup.c (ptw32_pop_cleanup): Add #warning to compile this file as C++ if using a cygwin32 environment. Perhaps the whole package should be compiled using g++ under cygwin. - * private.c (_pthread_threadStart): Change #error directive + * private.c (ptw32_threadStart): Change #error directive into #warning and bracket for __CYGWIN__ and derivative compilers. Wed Jan 13 09:34:52 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> @@ -1153,7 +1159,7 @@ Mon Jan 11 20:33:19 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * pthread.h: Re-arrange conditional compile of pthread_cleanup-* macros. - * cleanup.c (_pthread_push_cleanup): Provide conditional + * cleanup.c (ptw32_push_cleanup): Provide conditional compile of cleanup->prev. 1999-01-11 Ben Elliston <bje@cygnus.com> @@ -1170,7 +1176,7 @@ Sat Jan 9 14:32:08 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Tue Jan 5 16:33:04 1999 Ross Johnson <rpj@swan.canberra.edu.au> - * cleanup.c (_pthread_pop_cleanup): Add C++ version of __try/__except + * cleanup.c (ptw32_pop_cleanup): Add C++ version of __try/__except block. Move trailing "}" out of #ifdef _WIN32 block left there by (rpj's) mistake. @@ -1206,11 +1212,11 @@ Tue Dec 29 13:11:16 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Now unimplemented. * tsd.c (pthread_setspecific): Rename tkAssocCreate to - _pthread_tkAssocCreate. + ptw32_tkAssocCreate. (pthread_key_delete): Rename tkAssocDestroy to - _pthread_tkAssocDestroy. + ptw32_tkAssocDestroy. - * sync.c (pthread_join): Rename threadDestroy to _pthread_threadDestroy + * sync.c (pthread_join): Rename threadDestroy to ptw32_threadDestroy * sched.c (is_attr): attr is now **attr (was *attr), so add extra NULL pointer test. @@ -1221,8 +1227,8 @@ Tue Dec 29 13:11:16 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Win32 thread Handle element name to match John Bossom's version. (pthread_getschedparam): Ditto. - * private.c (_pthread_threadDestroy): Rename call to - callUserDestroyRoutines() as _pthread_callUserDestroyRoutines() + * private.c (ptw32_threadDestroy): Rename call to + callUserDestroyRoutines() as ptw32_callUserDestroyRoutines() * misc.c: Add #include "implement.h". @@ -1232,7 +1238,7 @@ Tue Dec 29 13:11:16 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Remove pthread_atfork() and fork() with #if 0/#endif. * create.c (pthread_create): Rename threadStart and threadDestroy calls - to _pthread_threadStart and _pthread_threadDestroy. + to ptw32_threadStart and ptw32_threadDestroy. * implement.h: Rename "detachedstate" to "detachstate". @@ -1312,14 +1318,14 @@ Mon Dec 7 09:44:40 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * create.c (pthread_create): Replaced by John Bossom's version. - * private.c (_pthread_processInitialize): New by John Bossom. - (_pthread_processTerminate): Non-public function by John Bossom. - (_pthread_threadStart): Non-public function by John Bossom. - (_pthread_threadDestroy): Non-public function by John Bossom. - (_pthread_cleanupStack): Non-public function by John Bossom. - (_pthread_tkAssocCreate): Non-public function by John Bossom. - (_pthread_tkAssocDestroy): Non-public function by John Bossom. - (_pthread_callUserDestroyRoutines): Non-public function by John Bossom. + * private.c (ptw32_processInitialize): New by John Bossom. + (ptw32_processTerminate): Non-public function by John Bossom. + (ptw32_threadStart): Non-public function by John Bossom. + (ptw32_threadDestroy): Non-public function by John Bossom. + (ptw32_cleanupStack): Non-public function by John Bossom. + (ptw32_tkAssocCreate): Non-public function by John Bossom. + (ptw32_tkAssocDestroy): Non-public function by John Bossom. + (ptw32_callUserDestroyRoutines): Non-public function by John Bossom. * implement.h: Added John Bossom's non-API structures and declarations. @@ -1330,20 +1336,20 @@ Mon Dec 7 09:44:40 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * dll.c (DLLmain): Replaced by John Bossom's version. * dll.c (PthreadsEntryPoint): Re-applied Anders Norlander's patch:- - Initialize _pthread_try_enter_critical_section at startup + Initialize ptw32_try_enter_critical_section at startup and release kernel32 handle when DLL is being unloaded. Sun Dec 6 21:54:35 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * buildlib.bat: Fix args to CL when building the .DLL - * cleanup.c (_pthread_destructor_run_all): Fix TSD key management. + * cleanup.c (ptw32_destructor_run_all): Fix TSD key management. This is a tidy-up before TSD and Thread management is completely replaced by John Bossom's code. * tsd.c (pthread_key_create): Fix TSD key management. - * global.c (_pthread_key_virgin_next): Initialise. + * global.c (ptw32_key_virgin_next): Initialise. * build.bat: New DOS script to compile and link a pthreads app using Microsoft's CL compiler linker. @@ -1353,15 +1359,15 @@ Sun Dec 6 21:54:35 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> 1998-12-05 Anders Norlander <anorland@hem2.passagen.se> - * implement.h (_pthread_try_enter_critical_section): New extern - * dll.c (_pthread_try_enter_critical_section): New pointer to + * implement.h (ptw32_try_enter_critical_section): New extern + * dll.c (ptw32_try_enter_critical_section): New pointer to TryEnterCriticalSection if it exists; otherwise NULL. * dll.c (PthreadsEntryPoint): - Initialize _pthread_try_enter_critical_section at startup + Initialize ptw32_try_enter_critical_section at startup and release kernel32 handle when DLL is being unloaded. * mutex.c (pthread_mutex_trylock): Replaced check for NT with - a check if _pthread_try_enter_critical_section is valid - pointer to a function. Call _pthread_try_enter_critical_section + a check if ptw32_try_enter_critical_section is valid + pointer to a function. Call ptw32_try_enter_critical_section instead of TryEnterCriticalSection to avoid errors on Win95. Thu Dec 3 13:32:00 1998 Ross Johnson <rpj@ise.canberra.edu.au> @@ -1370,7 +1376,7 @@ Thu Dec 3 13:32:00 1998 Ross Johnson <rpj@ise.canberra.edu.au> Sun Nov 15 21:24:06 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * cleanup.c (_pthread_destructor_run_all): Declare missing void * arg. + * cleanup.c (ptw32_destructor_run_all): Declare missing void * arg. Fixup CVS merge conflicts. 1998-10-30 Ben Elliston <bje@cygnus.com> @@ -1380,7 +1386,7 @@ Sun Nov 15 21:24:06 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Fri Oct 30 15:15:50 1998 Ross Johnson <rpj@swan.canberra.edu.au> - * cleanup.c (_pthread_handler_push): Fixed bug appending new + * cleanup.c (ptw32_handler_push): Fixed bug appending new handler to list reported by Peter Slacik <Peter.Slacik@leibinger.freinet.de>. (new_thread): Rename poorly named local variable to @@ -1396,10 +1402,10 @@ Fri Oct 23 00:08:09 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * implement.h (_PTHREAD_TSD_KEY_REUSE): Add enum. - * private.c (_pthread_delete_thread): Add call to - _pthread_destructor_run_all() to clean up the threads keys. + * private.c (ptw32_delete_thread): Add call to + ptw32_destructor_run_all() to clean up the threads keys. - * cleanup.c (_pthread_destructor_run_all): Check for no more dirty + * cleanup.c (ptw32_destructor_run_all): Check for no more dirty keys to run destructors on. Assume that the destructor call always succeeds and set the key value to NULL. @@ -1409,19 +1415,19 @@ Thu Oct 22 21:44:44 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> (pthread_key_create): Ditto. (pthread_key_delete): Ditto. - * implement.h (struct _pthread_tsd_key): Add status member. + * implement.h (struct ptw32_tsd_key): Add status member. * tsd.c: Add description of pthread_key_delete() from the standard as a comment. Fri Oct 16 17:38:47 1998 Ross Johnson <rpj@swan.canberra.edu.au> - * cleanup.c (_pthread_destructor_run_all): Fix and improve + * cleanup.c (ptw32_destructor_run_all): Fix and improve stepping through the key table. Thu Oct 15 14:05:01 1998 Ross Johnson <rpj@swan.canberra.edu.au> - * private.c (_pthread_new_thread): Remove init of destructorstack. + * private.c (ptw32_new_thread): Remove init of destructorstack. No longer an element of pthread_t. * tsd.c (pthread_setspecific): Fix type declaration and cast. @@ -1431,34 +1437,34 @@ Thu Oct 15 14:05:01 1998 Ross Johnson <rpj@swan.canberra.edu.au> Thu Oct 15 11:53:21 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * global.c (_pthread_tsd_key_table): Fix declaration. + * global.c (ptw32_tsd_key_table): Fix declaration. - * implement.h(_pthread_TSD_keys_TlsIndex): Add missing extern. - (_pthread_tsd_mutex): Ditto. + * implement.h(ptw32_TSD_keys_TlsIndex): Add missing extern. + (ptw32_tsd_mutex): Ditto. - * create.c (_pthread_start_call): Fix "keys" array declaration. + * create.c (ptw32_start_call): Fix "keys" array declaration. Add comment. * tsd.c (pthread_setspecific): Fix type declaration and cast. (pthread_getspecific): Ditto. - * cleanup.c (_pthread_destructor_run_all): Declare missing loop + * cleanup.c (ptw32_destructor_run_all): Declare missing loop counter. Wed Oct 14 21:09:24 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * private.c (_pthread_new_thread): Increment _pthread_threads_count. - (_pthread_delete_thread): Decrement _pthread_threads_count. + * private.c (ptw32_new_thread): Increment ptw32_threads_count. + (ptw32_delete_thread): Decrement ptw32_threads_count. Remove some comments. - * exit.c (_pthread_exit): : Fix two pthread_mutex_lock() calls that + * exit.c (ptw32_exit): : Fix two pthread_mutex_lock() calls that should have been pthread_mutex_unlock() calls. - (_pthread_vacuum): Remove call to _pthread_destructor_pop_all(). + (ptw32_vacuum): Remove call to ptw32_destructor_pop_all(). * create.c (pthread_create): Fix two pthread_mutex_lock() calls that should have been pthread_mutex_unlock() calls. - * global.c (_pthread_tsd_mutex): Add mutex for TSD operations. + * global.c (ptw32_tsd_mutex): Add mutex for TSD operations. * tsd.c (pthread_key_create): Add critical section. (pthread_setspecific): Ditto. @@ -1470,24 +1476,24 @@ Wed Oct 14 21:09:24 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Mon Oct 12 00:00:44 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * implement.h (_pthread_tsd_key_table): New. + * implement.h (ptw32_tsd_key_table): New. - * create.c (_pthread_start_call): Initialise per-thread TSD keys + * create.c (ptw32_start_call): Initialise per-thread TSD keys to NULL. * misc.c (pthread_once): Correct typo in comment. - * implement.h (_pthread_destructor_push): Remove. - (_pthread_destructor_pop): Remove. - (_pthread_destructor_run_all): Rename from _pthread_destructor_pop_all. + * implement.h (ptw32_destructor_push): Remove. + (ptw32_destructor_pop): Remove. + (ptw32_destructor_run_all): Rename from ptw32_destructor_pop_all. (_PTHREAD_TSD_KEY_DELETED): Add enum. (_PTHREAD_TSD_KEY_INUSE): Add enum. - * cleanup.c (_pthread_destructor_push): Remove. - (_pthread_destructor_pop): Remove. - (_pthread_destructor_run_all): Totally revamped TSD. + * cleanup.c (ptw32_destructor_push): Remove. + (ptw32_destructor_pop): Remove. + (ptw32_destructor_run_all): Totally revamped TSD. - * dll.c (_pthread_TSD_keys_TlsIndex): Initialise. + * dll.c (ptw32_TSD_keys_TlsIndex): Initialise. * tsd.c (pthread_setspecific): Totally revamped TSD. (pthread_getspecific): Ditto. @@ -1496,14 +1502,14 @@ Mon Oct 12 00:00:44 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Sun Oct 11 22:44:55 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * global.c (_pthread_tsd_key_table): Add new global. + * global.c (ptw32_tsd_key_table): Add new global. - * implement.h (_pthread_tsd_key_t and struct _pthread_tsd_key): + * implement.h (ptw32_tsd_key_t and struct ptw32_tsd_key): Add. (struct _pthread): Remove destructorstack. - * cleanup.c (_pthread_destructor_run_all): Rename from - _pthread_destructor_pop_all. The key destructor stack was made + * cleanup.c (ptw32_destructor_run_all): Rename from + ptw32_destructor_pop_all. The key destructor stack was made global rather than per-thread. No longer removes destructor nodes from the stack. Comments updated. @@ -1593,7 +1599,7 @@ Mon Oct 5 14:25:08 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * config.h.in: Regenerate. - * create.c (_pthread_start_call): Add STDCALL prefix. + * create.c (ptw32_start_call): Add STDCALL prefix. * mutex.c (pthread_mutex_init): Correct function signature. @@ -1679,30 +1685,30 @@ Thu Aug 6 15:19:22 1998 Ross Johnson <rpj@swan.canberra.edu.au> and LeaveCriticalSection() calls to pass address-of lock. * fork.c (pthread_atfork): Typecast (void (*)(void *)) funcptr - in each _pthread_handler_push() call. + in each ptw32_handler_push() call. - * exit.c (_pthread_exit): Fix attr arg in + * exit.c (ptw32_exit): Fix attr arg in pthread_attr_getdetachstate() call. - * private.c (_pthread_new_thread): Typecast (HANDLE) NULL. - (_pthread_delete_thread): Ditto. + * private.c (ptw32_new_thread): Typecast (HANDLE) NULL. + (ptw32_delete_thread): Ditto. * implement.h: (_PTHREAD_MAX_THREADS): Add define. This keeps changing in an attempt to make thread administration data types opaque and cleanup DLL startup. * dll.c (PthreadsEntryPoint): - (_pthread_virgins): Remove malloc() and free() calls. - (_pthread_reuse): Ditto. - (_pthread_win32handle_map): Ditto. - (_pthread_threads_mutex_table): Ditto. + (ptw32_virgins): Remove malloc() and free() calls. + (ptw32_reuse): Ditto. + (ptw32_win32handle_map): Ditto. + (ptw32_threads_mutex_table): Ditto. * global.c (_POSIX_THREAD_THREADS_MAX): Initialise with _PTHREAD_MAX_THREADS. - (_pthread_virgins): Ditto. - (_pthread_reuse): Ditto. - (_pthread_win32handle_map): Ditto. - (_pthread_threads_mutex_table): Ditto. + (ptw32_virgins): Ditto. + (ptw32_reuse): Ditto. + (ptw32_win32handle_map): Ditto. + (ptw32_threads_mutex_table): Ditto. * create.c (pthread_create): Typecast (HANDLE) NULL. Typecast (unsigned (*)(void *)) start_routine. @@ -1712,14 +1718,14 @@ Thu Aug 6 15:19:22 1998 Ross Johnson <rpj@swan.canberra.edu.au> (pthread_cond_destroy): Add address-of operator & to arg 1 of pthread_mutex_destroy() call. - * cleanup.c (_pthread_destructor_pop_all): Add (int) cast to + * cleanup.c (ptw32_destructor_pop_all): Add (int) cast to pthread_getspecific() arg. - (_pthread_destructor_pop): Add (void *) cast to "if" conditional. - (_pthread_destructor_push): Add (void *) cast to - _pthread_handler_push() "key" arg. + (ptw32_destructor_pop): Add (void *) cast to "if" conditional. + (ptw32_destructor_push): Add (void *) cast to + ptw32_handler_push() "key" arg. (malloc.h): Add include. - * implement.h (_pthread_destructor_pop): Add prototype. + * implement.h (ptw32_destructor_pop): Add prototype. * tsd.c (implement.h): Add include. @@ -1749,59 +1755,59 @@ Thu Aug 6 15:19:22 1998 Ross Johnson <rpj@swan.canberra.edu.au> Tue Aug 4 16:57:58 1998 Ross Johnson <rpj@swan.canberra.edu.au> - * private.c (_pthread_delete_thread): Fix typo. Add missing ';'. + * private.c (ptw32_delete_thread): Fix typo. Add missing ';'. - * global.c (_pthread_virgins): Change types from pointer to + * global.c (ptw32_virgins): Change types from pointer to array pointer. - (_pthread_reuse): Ditto. - (_pthread_win32handle_map): Ditto. - (_pthread_threads_mutex_table): Ditto. + (ptw32_reuse): Ditto. + (ptw32_win32handle_map): Ditto. + (ptw32_threads_mutex_table): Ditto. - * implement.h(_pthread_virgins): Change types from pointer to + * implement.h(ptw32_virgins): Change types from pointer to array pointer. - (_pthread_reuse): Ditto. - (_pthread_win32handle_map): Ditto. - (_pthread_threads_mutex_table): Ditto. + (ptw32_reuse): Ditto. + (ptw32_win32handle_map): Ditto. + (ptw32_threads_mutex_table): Ditto. - * private.c (_pthread_delete_thread): Fix "entry" should be "thread". + * private.c (ptw32_delete_thread): Fix "entry" should be "thread". - * misc.c (pthread_self): Add extern for _pthread_threadID_TlsIndex. + * misc.c (pthread_self): Add extern for ptw32_threadID_TlsIndex. * global.c: Add comment. * misc.c (pthread_once): Fix member -> dereferences. - Change _pthread_once_flag to once_control->flag in "if" test. + Change ptw32_once_flag to once_control->flag in "if" test. Tue Aug 4 00:09:30 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * implement.h(_pthread_virgins): Add extern. - (_pthread_virgin_next): Ditto. - (_pthread_reuse): Ditto. - (_pthread_reuse_top): Ditto. - (_pthread_win32handle_map): Ditto. - (_pthread_threads_mutex_table): Ditto. + * implement.h(ptw32_virgins): Add extern. + (ptw32_virgin_next): Ditto. + (ptw32_reuse): Ditto. + (ptw32_reuse_top): Ditto. + (ptw32_win32handle_map): Ditto. + (ptw32_threads_mutex_table): Ditto. - * global.c (_pthread_virgins): Changed from array to pointer. + * global.c (ptw32_virgins): Changed from array to pointer. Storage allocation for the array moved into dll.c. - (_pthread_reuse): Ditto. - (_pthread_win32handle_map): Ditto. - (_pthread_threads_mutex_table): Ditto. + (ptw32_reuse): Ditto. + (ptw32_win32handle_map): Ditto. + (ptw32_threads_mutex_table): Ditto. * dll.c (PthreadsEntryPoint): Set up thread admin storage when DLL is loaded. * fork.c (pthread_atfork): Fix function pointer arg to all - _pthread_handler_push() calls. Change "arg" arg to NULL in child push. + ptw32_handler_push() calls. Change "arg" arg to NULL in child push. * exit.c: Add windows.h and process.h includes. - (_pthread_exit): Add local detachstate declaration. - (_pthread_exit): Fix incorrect name for pthread_attr_getdetachstate(). + (ptw32_exit): Add local detachstate declaration. + (ptw32_exit): Fix incorrect name for pthread_attr_getdetachstate(). * pthread.h (_POSIX_THREAD_ATTR_STACKSIZE): Move from global.c (_POSIX_THREAD_ATTR_STACKADDR): Ditto. * create.c (pthread_create): Fix #if should be #ifdef. - (_pthread_start_call): Remove usused variables. + (ptw32_start_call): Remove usused variables. * process.h: Create. @@ -1816,7 +1822,7 @@ Mon Aug 3 21:19:57 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> (cond_wait): Fix typo - cv was ev. (pthread_cond_broadcast): Fix two identical typos. - * cleanup.c (_pthread_destructor_pop_all): Remove _ prefix from + * cleanup.c (ptw32_destructor_pop_all): Remove _ prefix from PTHREAD_DESTRUCTOR_ITERATIONS. * pthread.h: Move _POSIX_* values into posix.h @@ -1836,7 +1842,7 @@ Mon Aug 3 21:19:57 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * implement.h (_PTHREAD_HANDLER_POP_LIFO): Remove definition. (_PTHREAD_HANDLER_POP_FIFO): Ditto. (_PTHREAD_VALID): Add missing newline escape (\). - (_pthread_handler_node): Make element "next" a pointer. + (ptw32_handler_node): Make element "next" a pointer. 1998-08-02 Ben Elliston <bje@cygnus.com> @@ -1861,11 +1867,11 @@ Sun Aug 2 19:03:42 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Fri Jul 31 14:00:29 1998 Ross Johnson <rpj@swan.canberra.edu.au> - * cleanup.c (_pthread_destructor_pop): Implement. Removes + * cleanup.c (ptw32_destructor_pop): Implement. Removes destructors associated with a key without executing them. - (_pthread_destructor_pop_all): Add FIXME comment. + (ptw32_destructor_pop_all): Add FIXME comment. - * tsd.c (pthread_key_delete): Add call to _pthread_destructor_pop(). + * tsd.c (pthread_key_delete): Add call to ptw32_destructor_pop(). Fri Jul 31 00:05:45 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> @@ -1873,16 +1879,16 @@ Fri Jul 31 00:05:45 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> the destructor routine with the key. (pthread_key_delete): Add FIXME comment. - * exit.c (_pthread_vacuum): Add call to - _pthread_destructor_pop_all(). + * exit.c (ptw32_vacuum): Add call to + ptw32_destructor_pop_all(). - * implement.h (_pthread_handler_pop_all): Add prototype. - (_pthread_destructor_pop_all): Ditto. + * implement.h (ptw32_handler_pop_all): Add prototype. + (ptw32_destructor_pop_all): Ditto. - * cleanup.c (_pthread_destructor_push): Implement. This is just a - call to _pthread_handler_push(). - (_pthread_destructor_pop_all): Implement. This is significantly - different to _pthread_handler_pop_all(). + * cleanup.c (ptw32_destructor_push): Implement. This is just a + call to ptw32_handler_push(). + (ptw32_destructor_pop_all): Implement. This is significantly + different to ptw32_handler_pop_all(). * Makefile (SRCS): Create. Preliminary. @@ -1902,19 +1908,19 @@ Fri Jul 31 00:05:45 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Thu Jul 30 23:12:45 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * implement.h: Remove _pthread_find_entry() prototype. + * implement.h: Remove ptw32_find_entry() prototype. * private.c: Extend comments. - Remove _pthread_find_entry() - no longer needed. + Remove ptw32_find_entry() - no longer needed. - * create.c (_pthread_start_call): Add call to TlsSetValue() to + * create.c (ptw32_start_call): Add call to TlsSetValue() to store the thread ID. * dll.c (PthreadsEntryPoint): Implement. This is called whenever a process loads the DLL. Used to initialise thread local storage. - * implement.h: Add _pthread_threadID_TlsIndex. + * implement.h: Add ptw32_threadID_TlsIndex. Add ()s around _PTHREAD_VALID expression. * misc.c (pthread_self): Re-implement using Win32 TLS to store @@ -1923,13 +1929,13 @@ Thu Jul 30 23:12:45 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Wed Jul 29 11:39:03 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * private.c: Corrections in comments. - (_pthread_new_thread): Alter "if" flow to be more natural. + (ptw32_new_thread): Alter "if" flow to be more natural. - * cleanup.c (_pthread_handler_push): Same as below. + * cleanup.c (ptw32_handler_push): Same as below. * create.c (pthread_create): Same as below. - * private.c (_pthread_new_thread): Rename "new" to "new_thread". + * private.c (ptw32_new_thread): Rename "new" to "new_thread". Since when has a C programmer been required to know C++? Tue Jul 28 14:04:29 1998 Ross Johnson <rpj@swan.canberra.edu.au> @@ -1937,7 +1943,7 @@ Tue Jul 28 14:04:29 1998 Ross Johnson <rpj@swan.canberra.edu.au> * implement.h: Add _PTHREAD_VALID macro. * sync.c (pthread_join): Modify to use the new thread - type and _pthread_delete_thread(). Rename "target" to "thread". + type and ptw32_delete_thread(). Rename "target" to "thread". Remove extra local variable "target". (pthread_detach): Ditto. @@ -1948,15 +1954,15 @@ Tue Jul 28 14:04:29 1998 Ross Johnson <rpj@swan.canberra.edu.au> type. (pthread_getschedparam): Ditto. - * private.c (_pthread_find_thread): Fix return type and arg. + * private.c (ptw32_find_thread): Fix return type and arg. * implement.h: Remove _PTHREAD_YES and _PTHREAD_NO. - (_pthread_new_thread): Add prototype. - (_pthread_find_thread): Ditto. - (_pthread_delete_thread): Ditto. - (_pthread_new_thread_entry): Remove prototype. - (_pthread_find_thread_entry): Ditto. - (_pthread_delete_thread_entry): Ditto. + (ptw32_new_thread): Add prototype. + (ptw32_find_thread): Ditto. + (ptw32_delete_thread): Ditto. + (ptw32_new_thread_entry): Remove prototype. + (ptw32_find_thread_entry): Ditto. + (ptw32_delete_thread_entry): Ditto. ( _PTHREAD_NEW, _PTHREAD_INUSE, _PTHREAD_EXITED, _PTHREAD_REUSE): Add. @@ -1970,36 +1976,36 @@ Tue Jul 28 14:04:29 1998 Ross Johnson <rpj@swan.canberra.edu.au> * exit.c (pthread_exit): Fix pthread_this should be pthread_self. * cancel.c (pthread_setcancelstate): Change - _pthread_threads_thread_t * to pthread_t and init with + ptw32_threads_thread_t * to pthread_t and init with pthread_this(). (pthread_setcanceltype): Ditto. - * exit.c (_pthread_exit): Add new pthread_t arg. - Rename _pthread_delete_thread_entry to _pthread_delete_thread. + * exit.c (ptw32_exit): Add new pthread_t arg. + Rename ptw32_delete_thread_entry to ptw32_delete_thread. Rename "us" to "thread". - (pthread_exit): Call _pthread_exit with added thread arg. + (pthread_exit): Call ptw32_exit with added thread arg. - * create.c (_pthread_start_call): Insert missing ")". - Add "us" arg to _pthread_exit() call. + * create.c (ptw32_start_call): Insert missing ")". + Add "us" arg to ptw32_exit() call. (pthread_create): Modify to use new thread allocation scheme. * private.c: Added detailed explanation of the new thread allocation scheme. - (_pthread_new_thread): Totally rewritten to use + (ptw32_new_thread): Totally rewritten to use new thread allocation scheme. - (_pthread_delete_thread): Ditto. - (_pthread_find_thread): Obsolete. + (ptw32_delete_thread): Ditto. + (ptw32_find_thread): Obsolete. Mon Jul 27 17:46:37 1998 Ross Johnson <rpj@swan.canberra.edu.au> * create.c (pthread_create): Start of rewrite. Not completed yet. - * private.c (_pthread_new_thread_entry): Start of rewrite. Not + * private.c (ptw32_new_thread_entry): Start of rewrite. Not complete. - * implement.h (_pthread_threads_thread): Rename, remove thread + * implement.h (ptw32_threads_thread): Rename, remove thread member, add win32handle and ptstatus members. - (_pthread_t): Add. + (ptw32_t): Add. * pthread.h: pthread_t is no longer mapped directly to a Win32 HANDLE type. This is so we can let the Win32 thread terminate and @@ -2008,40 +2014,40 @@ Mon Jul 27 17:46:37 1998 Ross Johnson <rpj@swan.canberra.edu.au> Mon Jul 27 00:20:37 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * private.c (_pthread_delete_thread_entry): Destroy the thread + * private.c (ptw32_delete_thread_entry): Destroy the thread entry attribute object before deleting the thread entry itself. * attr.c (pthread_attr_init): Initialise cancel_pending = FALSE. (pthread_attr_setdetachstate): Rename "detached" to "detachedstate". (pthread_attr_getdetachstate): Ditto. - * exit.c (_pthread_exit): Fix incorrect check for detachedstate. + * exit.c (ptw32_exit): Fix incorrect check for detachedstate. - * implement.h (_pthread_call_t): Remove env member. + * implement.h (ptw32_call_t): Remove env member. Sun Jul 26 13:06:12 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * implement.h (_pthread_new_thread_entry): Fix prototype. - (_pthread_find_thread_entry): Ditto. - (_pthread_delete_thread_entry): Ditto. - (_pthread_exit): Add prototype. + * implement.h (ptw32_new_thread_entry): Fix prototype. + (ptw32_find_thread_entry): Ditto. + (ptw32_delete_thread_entry): Ditto. + (ptw32_exit): Add prototype. - * exit.c (_pthread_exit): New function. Called from pthread_exit() - and _pthread_start_call() to exit the thread. It allows an extra + * exit.c (ptw32_exit): New function. Called from pthread_exit() + and ptw32_start_call() to exit the thread. It allows an extra argument which is the return code passed to _endthreadex(). - (_pthread_exit): Move thread entry delete call from _pthread_vacuum() + (ptw32_exit): Move thread entry delete call from ptw32_vacuum() into here. Add more explanation of thread entry deletion. - (_pthread_exit): Clarify comment. + (ptw32_exit): Clarify comment. - * create.c (_pthread_start_call): Change pthread_exit() call to - _pthread_exit() call. + * create.c (ptw32_start_call): Change pthread_exit() call to + ptw32_exit() call. - * exit.c (_pthread_vacuum): Add thread entry deletion code - moved from _pthread_start_call(). See next item. + * exit.c (ptw32_vacuum): Add thread entry deletion code + moved from ptw32_start_call(). See next item. (pthread_exit): Remove longjmp(). Add mutex lock around thread table manipulation code. This routine now calls _enthreadex(). - * create.c (_pthread_start_call): Remove setjmp() call and move + * create.c (ptw32_start_call): Remove setjmp() call and move cleanup code out. Call pthread_exit(NULL) to terminate the thread. 1998-07-26 Ben Elliston <bje@cygnus.com> @@ -2056,18 +2062,18 @@ Sun Jul 26 13:06:12 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Sun Jul 26 00:09:59 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * sync.c: Rename all instances of _pthread_count_mutex to - _pthread_table_mutex. + * sync.c: Rename all instances of ptw32_count_mutex to + ptw32_table_mutex. - * implement.h: Rename _pthread_count_mutex to - _pthread_table_mutex. + * implement.h: Rename ptw32_count_mutex to + ptw32_table_mutex. - * global.c: Rename _pthread_count_mutex to - _pthread_table_mutex. + * global.c: Rename ptw32_count_mutex to + ptw32_table_mutex. * create.c (pthread_create): Add critical sections. - (_pthread_start_call): Rename _pthread_count_mutex to - _pthread_table_mutex. + (ptw32_start_call): Rename ptw32_count_mutex to + ptw32_table_mutex. * cancel.c (pthread_setcancelstate): Fix indirection bug and rename "this" to "us". @@ -2102,22 +2108,22 @@ Sun Jul 26 00:09:59 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Only the thread itself can change it's cancelstate or canceltype, ie. the thread must exist already. - * private.c (_pthread_delete_thread_entry): Mutex locks removed. + * private.c (ptw32_delete_thread_entry): Mutex locks removed. Mutexes must be applied at the caller level. - (_pthread_new_thread_entry): Ditto. - (_pthread_new_thread_entry): Init cancelstate, canceltype, and + (ptw32_new_thread_entry): Ditto. + (ptw32_new_thread_entry): Init cancelstate, canceltype, and cancel_pending to default values. - (_pthread_new_thread_entry): Rename "this" to "new". - (_pthread_find_thread_entry): Rename "this" to "entry". - (_pthread_delete_thread_entry): Rename "thread_entry" to "entry". + (ptw32_new_thread_entry): Rename "this" to "new". + (ptw32_find_thread_entry): Rename "this" to "entry". + (ptw32_delete_thread_entry): Rename "thread_entry" to "entry". - * create.c (_pthread_start_call): Mutexes changed to - _pthread_count_mutex. All access to the threads table entries is + * create.c (ptw32_start_call): Mutexes changed to + ptw32_count_mutex. All access to the threads table entries is under the one mutex. Otherwise chaos reigns. Sat Jul 25 23:16:51 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * implement.h (_pthread_threads_thread): Move cancelstate and + * implement.h (ptw32_threads_thread): Move cancelstate and canceltype members out of pthread_attr_t into here. * fork.c (fork): Add comment. @@ -2128,7 +2134,7 @@ Sat Jul 25 23:16:51 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Sat Jul 25 00:00:13 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * create.c (_pthread_start_call): Set thread priority. Ensure our + * create.c (ptw32_start_call): Set thread priority. Ensure our thread entry is removed from the thread table but only if pthread_detach() was called and there are no waiting joins. (pthread_create): Set detach flag in thread entry if the @@ -2142,28 +2148,28 @@ Sat Jul 25 00:00:13 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * implement.h (_PTHREAD_THREADS_TABLE_INDEX): Add. - * exit.c (_pthread_vacuum): Fix incorrect args to - _pthread_handler_pop_all() calls. + * exit.c (ptw32_vacuum): Fix incorrect args to + ptw32_handler_pop_all() calls. Make thread entry removal conditional. * sync.c (pthread_join): Add multiple join and async detach handling. * implement.h (_PTHREAD_THREADS_TABLE_INDEX): Add. - * global.c (_pthread_threads_mutex_table): Add. + * global.c (ptw32_threads_mutex_table): Add. - * implement.h (_pthread_once_flag): Remove. - (_pthread_once_lock): Ditto. - (_pthread_threads_mutex_table): Add. + * implement.h (ptw32_once_flag): Remove. + (ptw32_once_lock): Ditto. + (ptw32_threads_mutex_table): Add. - * global.c (_pthread_once_flag): Remove. - (_pthread_once_lock): Ditto. + * global.c (ptw32_once_flag): Remove. + (ptw32_once_lock): Ditto. * sync.c (pthread_join): Fix tests involving new return value - from _pthread_find_thread_entry(). + from ptw32_find_thread_entry(). (pthread_detach): Ditto. - * private.c (_pthread_find_thread_entry): Failure return code + * private.c (ptw32_find_thread_entry): Failure return code changed from -1 to NULL. Fri Jul 24 23:09:33 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> @@ -2185,7 +2191,7 @@ Fri Jul 24 21:13:55 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * exit.c (pthread_exit): Add comment explaining the longjmp(). - * implement.h (_pthread_threads_thread_t): New member cancelthread. + * implement.h (ptw32_threads_thread_t): New member cancelthread. (_PTHREAD_YES): Define. (_PTHREAD_NO): Define. (RND_SIZEOF): Remove. @@ -2221,17 +2227,17 @@ Fri Jul 24 16:33:17 1998 Ross Johnson <rpj@swan.canberra.edu.au> and join calls to the child fork. Add #includes. - * implement.h: (_pthread_handler_push): Fix return type and stack arg + * implement.h: (ptw32_handler_push): Fix return type and stack arg type in prototype. - (_pthread_handler_pop): Fix stack arg type in prototype. - (_pthread_handler_pop_all): Fix stack arg type in prototype. + (ptw32_handler_pop): Fix stack arg type in prototype. + (ptw32_handler_pop_all): Fix stack arg type in prototype. - * cleanup.c (_pthread_handler_push): Change return type to int and + * cleanup.c (ptw32_handler_push): Change return type to int and return ENOMEM if malloc() fails. * sync.c (pthread_detach): Use equality test, not assignment. - * create.c (_pthread_start_call): Add call to Win32 CloseHandle() + * create.c (ptw32_start_call): Add call to Win32 CloseHandle() if thread is detached. 1998-07-24 Ben Elliston <bje@cygnus.com> @@ -2244,22 +2250,22 @@ Fri Jul 24 03:00:25 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * sync.c (pthread_join): Save valueptr arg in joinvalueptr for pthread_exit() to use. - * private.c (_pthread_new_thread_entry): Initialise joinvalueptr to + * private.c (ptw32_new_thread_entry): Initialise joinvalueptr to NULL. - * create.c (_pthread_start_call): Rewrite to facilitate joins. + * create.c (ptw32_start_call): Rewrite to facilitate joins. pthread_exit() will do a longjmp() back to here. Does appropriate cleanup and exit/return from the thread. (pthread_create): _beginthreadex() now passes a pointer to our thread table entry instead of just the call member of that entry. - * implement.h (_pthread_threads_thread): New member + * implement.h (ptw32_threads_thread): New member void ** joinvalueptr. - (_pthread_call_t): New member jmpbuf env. + (ptw32_call_t): New member jmpbuf env. * exit.c (pthread_exit): Major rewrite to handle joins and handing value pointer to joining thread. Uses longjmp() back to - _pthread_start_call(). + ptw32_start_call(). * create.c (pthread_create): Ensure values of new attribute members are copied to the thread attribute object. @@ -2279,7 +2285,7 @@ Fri Jul 24 00:21:21 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> (pthread_detach): Implement. After checking for a valid and joinable thread, it's still a no-op. - * private.c (_pthread_find_thread_entry): Bug prevented returning + * private.c (ptw32_find_thread_entry): Bug prevented returning an error value in some cases. * attr.c (pthread_attr_setdetachedstate): Implement. @@ -2342,18 +2348,18 @@ Fri Jul 24 00:21:21 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Fri Jul 24 00:21:21 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * create.c (pthread_create): Arg to _pthread_new_thread_entry() + * create.c (pthread_create): Arg to ptw32_new_thread_entry() changed. See next entry. Move mutex locks out. Changes made yesterday and today allow us to start the new thread running rather than temporarily suspended. - * private.c (_pthread_new_thread_entry): _pthread_thread_table + * private.c (ptw32_new_thread_entry): ptw32_thread_table was changed back to a table of thread structures rather than pointers. As such we're trading storage for increaded speed. This routine was modified to work with the new table. Mutex lock put in around global data accesses. - (_pthread_find_thread_entry): Ditto - (_pthread_delete_thread_entry): Ditto + (ptw32_find_thread_entry): Ditto + (ptw32_delete_thread_entry): Ditto Thu Jul 23 23:25:30 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> @@ -2366,36 +2372,36 @@ Thu Jul 23 23:25:30 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * implement.h: Move implementation hidden definitions from pthread.h. Add constants to index into the different handler stacks. - * cleanup.c (_pthread_handler_push): Simplify args. Restructure. - (_pthread_handler_pop): Simplify args. Restructure. - (_pthread_handler_pop_all): Simplify args. Restructure. + * cleanup.c (ptw32_handler_push): Simplify args. Restructure. + (ptw32_handler_pop): Simplify args. Restructure. + (ptw32_handler_pop_all): Simplify args. Restructure. Wed Jul 22 00:16:22 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * attr.c, implement.h, pthread.h, ChangeLog: Resolve CVS merge conflicts. - * private.c (_pthread_find_thread_entry): Changes to return type - to support leaner _pthread_threads_table[] which now only stores - _pthread_thread_thread_t *. - (_pthread_new_thread_entry): Internal changes. - (_pthread_delete_thread_entry): Internal changes to avoid contention. + * private.c (ptw32_find_thread_entry): Changes to return type + to support leaner ptw32_threads_table[] which now only stores + ptw32_thread_thread_t *. + (ptw32_new_thread_entry): Internal changes. + (ptw32_delete_thread_entry): Internal changes to avoid contention. Calling routines changed accordingly. * pthread.h: Modified cleanup macros to use new generic push and pop. - Added destructor and atfork stacks to _pthread_threads_thread_t. + Added destructor and atfork stacks to ptw32_threads_thread_t. - * cleanup.c (_pthread_handler_push, _pthread_handler_pop, - _pthread_handler_pop_all): Renamed cleanup push and pop routines + * cleanup.c (ptw32_handler_push, ptw32_handler_pop, + ptw32_handler_pop_all): Renamed cleanup push and pop routines and made generic to handle destructors and atfork handlers as well. - * create.c (_pthread_start_call): New function is a wrapper for + * create.c (ptw32_start_call): New function is a wrapper for all new threads. It allows us to do some cleanup when the thread returns, ie. that is otherwise only done if the thread is cancelled. - * exit.c (_pthread_vacuum): New function contains code from - pthread_exit() that we need in the new _pthread_start_call() + * exit.c (ptw32_vacuum): New function contains code from + pthread_exit() that we need in the new ptw32_start_call() as well. * implement.h: Various additions and minor changes. @@ -2409,12 +2415,12 @@ Wed Jul 22 00:16:22 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * create.c (pthread_create): More clean up. - * private.c (_pthread_find_thread_entry): Implement. - (_pthread_delete_thread_entry): Implement. - (_pthread_new_thread_entry): Implement. + * private.c (ptw32_find_thread_entry): Implement. + (ptw32_delete_thread_entry): Implement. + (ptw32_new_thread_entry): Implement. These functions manipulate the implementations internal thread table and are part of general code cleanup and modularisation. - They replace _pthread_getthreadindex() which was removed. + They replace ptw32_getthreadindex() which was removed. * exit.c (pthread_exit): Changed to use the new code above. @@ -2433,22 +2439,22 @@ Wed Jul 22 00:16:22 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> (remove_attr): Likewise. (insert_attr): Likewise. - * implement.h (_pthread_mutexattr_t): Moved to a public definition + * implement.h (ptw32_mutexattr_t): Moved to a public definition in pthread.h. There was little gain in hiding these details. - (_pthread_condattr_t): Likewise. - (_pthread_attr_t): Likewise. + (ptw32_condattr_t): Likewise. + (ptw32_attr_t): Likewise. * pthread.h (pthread_atfork): Add function prototype. (pthread_attr_t): Moved here from implement.h. * fork.c (pthread_atfork): Preliminary implementation. - (_pthread_fork): Likewise. + (ptw32_fork): Likewise. Wed Jul 22 00:16:22 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * cleanup.c (_pthread_cleanup_push): Implement. - (_pthread_cleanup_pop): Implement. - (_pthread_do_cancellation): Implement. + * cleanup.c (ptw32_cleanup_push): Implement. + (ptw32_cleanup_pop): Implement. + (ptw32_do_cancellation): Implement. These are private to the implementation. The real cleanup functions are macros. See below. @@ -2465,7 +2471,7 @@ Wed Jul 22 00:16:22 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> up to multiple of DWORD. Add function prototypes. - * private.c (_pthread_getthreadindex): "*thread" should have been + * private.c (ptw32_getthreadindex): "*thread" should have been "thread". Detect empty slot fail condition. 1998-07-20 Ben Elliston <bje@cygnus.com> @@ -2474,21 +2480,21 @@ Wed Jul 22 00:16:22 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> flag and mutex--make `pthread_once_t' contain these elements in their structure. The earlier version had incorrect semantics. - * pthread.h (_pthread_once_flag): Add new variable. Remove. - (_pthread_once_lock): Add new mutex lock to ensure integrity of - access to _pthread_once_flag. Remove. + * pthread.h (ptw32_once_flag): Add new variable. Remove. + (ptw32_once_lock): Add new mutex lock to ensure integrity of + access to ptw32_once_flag. Remove. (pthread_once): Add function prototype. (pthread_once_t): Define this type. Mon Jul 20 02:31:05 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * private.c (_pthread_getthreadindex): Implement. + * private.c (ptw32_getthreadindex): Implement. * pthread.h: Add application static data dependent on _PTHREADS_BUILD_DLL define. This is needed to avoid allocating non-sharable static data within the pthread DLL. - * implement.h: Add _pthread_cleanup_stack_t, _pthread_cleanup_node_t + * implement.h: Add ptw32_cleanup_stack_t, ptw32_cleanup_node_t and _PTHREAD_HASH_INDEX. * exit.c (pthread_exit): Begin work on cleanup and de-allocate @@ -2502,10 +2508,10 @@ Mon Jul 20 02:31:05 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> Sun Jul 19 16:26:23 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> - * implement.h: Rename pthreads_thread_count to _pthread_threads_count. - Create _pthread_threads_thread_t struct to keep thread specific data. + * implement.h: Rename pthreads_thread_count to ptw32_threads_count. + Create ptw32_threads_thread_t struct to keep thread specific data. - * create.c: Rename pthreads_thread_count to _pthread_threads_count. + * create.c: Rename pthreads_thread_count to ptw32_threads_count. (pthread_create): Handle errors from CreateThread(). 1998-07-19 Ben Elliston <bje@cygnus.com> @@ -2554,7 +2560,7 @@ Sun Jul 19 16:26:23 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> that the mutex contained withing the pthread_cond_t structure will be a critical section. Use our new POSIX type! - * implement.h (_pthread_condattr_t): Remove shared attribute. + * implement.h (ptw32_condattr_t): Remove shared attribute. 1998-07-17 Ben Elliston <bje@cygnus.com> @@ -2564,7 +2570,7 @@ Sun Jul 19 16:26:23 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> (pthread_mutex_t): Use a Win32 CRITICAL_SECTION type for better performance. - * implement.h (_pthread_mutexattr_t): Remove shared attribute. + * implement.h (ptw32_mutexattr_t): Remove shared attribute. * mutex.c (pthread_mutexattr_setpshared): This optional function is no longer supported, since we want to implement POSIX mutex @@ -2622,8 +2628,8 @@ Mon Jul 13 01:09:55 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * implement.h (PTHREAD_THREADS_MAX): Remove trailing semicolon. (PTHREAD_STACK_MIN): Specify; needs confirming. - (_pthread_attr_t): Define this type. - (_pthread_condattr_t): Likewise. + (ptw32_attr_t): Define this type. + (ptw32_condattr_t): Likewise. * pthread.h (pthread_mutex_t): Define this type. (pthread_condattr_t): Likewise. @@ -2644,7 +2650,7 @@ Mon Jul 13 01:09:55 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> 1998-07-12 Ben Elliston <bje@cygnus.com> - * implement.h (_pthread_mutexattr_t): Define this implementation + * implement.h (ptw32_mutexattr_t): Define this implementation internal type. Application programmers only see a mutex attribute object as a void pointer. @@ -118,7 +118,7 @@ the Known Problem listed below. > main thread, so the bug appears with 2 or more worker threads. > > Kevin Ruland has traced the exception to the try/catch blocks in -> _pthread_threadStart(). +> ptw32_threadStart(). > The official word is: @@ -56,7 +56,7 @@ Known bugs in this snapshot 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().
+end of the try block in ptw32_threadStart().
2. There are problems using the libpthreadw32.a stub archive derived
from either of pthreadVSE.dll or pthreadVCE.dll. The cleanup1.c test
@@ -132,30 +132,30 @@ thread handle with GetCurrentThread() is sufficient, and it seems to work perfectly fine, so maybe DuplicateHandle was just plain useless to begin with ? ------------------------------------ -- In private.c, added some code at the beginning of _pthread_processInitialize -to detect the case of multiple calls to _pthread_processInitialize. +- In private.c, added some code at the beginning of ptw32_processInitialize +to detect the case of multiple calls to ptw32_processInitialize. Rational: In order to debug pthread-win32, it is easier to compile it as a regular library (it is not possible to debug DLL's on winCE). -In that case, the application must call _pthread_processInitialize() +In that case, the application must call ptw32_rocessInitialize() explicitely, to initialize pthread-win32. It is safer in this circumstance -to handle the case where _pthread_processInitialize() is called on +to handle the case where ptw32_processInitialize() is called on an already initialized library: int -_pthread_processInitialize (void) +ptw32_processInitialize (void) { - if (_pthread_processInitialized) { + if (ptw32_processInitialized) { /* * ignore if already initialized. this is useful for * programs that uses a non-dll pthread - * library. such programs must call _pthread_processInitialize() explicitely, + * library. such programs must call ptw32_processInitialize() explicitely, * since this initialization routine is automatically called only when * the dll is loaded. */ return TRUE; } - _pthread_processInitialized = TRUE; + ptw32_processInitialized = TRUE; [...] } diff --git a/buildlib.bat b/buildlib.bat index 0fb3f59..ab51e7a 100644 --- a/buildlib.bat +++ b/buildlib.bat @@ -55,4 +55,4 @@ cl /LD /Zi *.obj /Fepthread.dll /link /nodefaultlib:libcmt /implib:pthread.lib m goto end
-:end
\ No newline at end of file +:end @@ -28,7 +28,7 @@ static void -_pthread_cancel_self(void) +ptw32_cancel_self(void) { #if defined(_MSC_VER) && !defined(__cplusplus) @@ -59,10 +59,10 @@ _pthread_cancel_self(void) /* - * _pthread_cancel_thread implements asynchronous cancellation. + * ptw32_cancel_thread implements asynchronous cancellation. */ static void -_pthread_cancel_thread(pthread_t thread) +ptw32_ancel_thread(pthread_t thread) { HANDLE threadH = thread->threadH; @@ -76,7 +76,7 @@ _pthread_cancel_thread(pthread_t thread) CONTEXT context; context.ContextFlags = CONTEXT_CONTROL; GetThreadContext(threadH, &context); - context.Eip = (DWORD) _pthread_cancel_self; + context.Eip = (DWORD) ptw32_cancel_self; SetThreadContext(threadH, &context); #endif ResumeThread(threadH); @@ -128,7 +128,7 @@ pthread_setcancelstate (int state, int *oldstate) */ { int result = 0; - pthread_t self = (pthread_t) pthread_getspecific (_pthread_selfThreadKey); + pthread_t self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey); if (self == NULL || (state != PTHREAD_CANCEL_ENABLE @@ -158,7 +158,7 @@ pthread_setcancelstate (int state, int *oldstate) { ResetEvent(self->cancelEvent); (void) pthread_mutex_unlock(&self->cancelLock); - _pthread_cancel_self(); + ptw32_cancel_self(); /* Never reached */ } @@ -212,7 +212,7 @@ pthread_setcanceltype (int type, int *oldtype) */ { int result = 0; - pthread_t self = (pthread_t) pthread_getspecific (_pthread_selfThreadKey); + pthread_t self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey); if (self == NULL || (type != PTHREAD_CANCEL_DEFERRED @@ -242,7 +242,7 @@ pthread_setcanceltype (int type, int *oldtype) { ResetEvent(self->cancelEvent); (void) pthread_mutex_unlock(&self->cancelLock); - _pthread_cancel_self(); + ptw32_cancel_self(); /* Never reached */ } @@ -283,7 +283,7 @@ pthread_testcancel (void) * ------------------------------------------------------ */ { - pthread_t self = (pthread_t) pthread_getspecific (_pthread_selfThreadKey); + pthread_t self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey); if (self != NULL && self->cancelState == PTHREAD_CANCEL_ENABLE @@ -355,7 +355,7 @@ pthread_cancel (pthread_t thread) } result = 0; - self = (pthread_t) pthread_getspecific (_pthread_selfThreadKey); + self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey); /* * FIXME!! @@ -384,12 +384,12 @@ pthread_cancel (pthread_t thread) if (cancel_self) { (void) pthread_mutex_unlock(&self->cancelLock); - _pthread_cancel_self(); + ptw32_cancel_self(); /* Never reached */ } - _pthread_cancel_thread(thread); + ptw32_cancel_thread(thread); } else { @@ -40,7 +40,7 @@ * SEH or C++ destructor support. */ -_pthread_cleanup_t * +ptw32_cleanup_t * pthread_pop_cleanup (int execute) /* * ------------------------------------------------------ @@ -67,9 +67,9 @@ pthread_pop_cleanup (int execute) * ------------------------------------------------------ */ { - _pthread_cleanup_t *cleanup = NULL; + ptw32_cleanup_t *cleanup = NULL; - cleanup = (_pthread_cleanup_t *) pthread_getspecific (_pthread_cleanupKey); + cleanup = (ptw32_leanup_t *) pthread_getspecific (ptw32_leanupKey); if (cleanup != NULL) { @@ -129,7 +129,7 @@ pthread_pop_cleanup (int execute) #if !defined(_MSC_VER) && !defined(__cplusplus) - pthread_setspecific (_pthread_cleanupKey, (void *) cleanup->prev); + pthread_setspecific (ptw32_cleanupKey, (void *) cleanup->prev); #endif /* !_MSC_VER && !__cplusplus */ @@ -137,11 +137,11 @@ pthread_pop_cleanup (int execute) return (cleanup); -} /* _pthread_pop_cleanup */ +} /* ptw32_pop_cleanup */ void -pthread_push_cleanup (_pthread_cleanup_t * cleanup, +pthread_push_cleanup (ptw32_cleanup_t * cleanup, void (*routine) (void *), void *arg) /* @@ -189,12 +189,12 @@ pthread_push_cleanup (_pthread_cleanup_t * cleanup, #if !defined(_MSC_VER) && !defined(__cplusplus) - cleanup->prev = (_pthread_cleanup_t *) pthread_getspecific (_pthread_cleanupKey); + cleanup->prev = (ptw32_cleanup_t *) pthread_getspecific (ptw32_cleanupKey); #endif /* !_MSC_VER && !__cplusplus */ - pthread_setspecific (_pthread_cleanupKey, (void *) cleanup); + pthread_setspecific (ptw32_cleanupKey, (void *) cleanup); -} /* _pthread_push_cleanup */ +} /* ptw32_push_cleanup */ @@ -52,7 +52,7 @@ _cond_check_need_init(pthread_cond_t *cond) * the number of processors + 1. * */ - EnterCriticalSection(&_pthread_cond_test_init_lock); + EnterCriticalSection(&ptw32_cond_test_init_lock); /* * We got here possibly under race @@ -75,7 +75,7 @@ _cond_check_need_init(pthread_cond_t *cond) result = EINVAL; } - LeaveCriticalSection(&_pthread_cond_test_init_lock); + LeaveCriticalSection(&ptw32_cond_test_init_lock); return(result); } @@ -492,7 +492,7 @@ pthread_cond_destroy (pthread_cond_t * cond) /* * See notes in _cond_check_need_init() above also. */ - EnterCriticalSection(&_pthread_cond_test_init_lock); + EnterCriticalSection(&ptw32_ond_test_init_lock); /* * Check again. @@ -516,7 +516,7 @@ pthread_cond_destroy (pthread_cond_t * cond) result = EBUSY; } - LeaveCriticalSection(&_pthread_cond_test_init_lock); + LeaveCriticalSection(&ptw32_cond_test_init_lock); } return (result); @@ -655,14 +655,14 @@ cond_timedwait (pthread_cond_t * cond, * timeout * * Note: - * _pthread_sem_timedwait is a cancelation point, + * ptw32_sem_timedwait is a cancelation point, * hence providing the * mechanism for making pthread_cond_wait a cancelation * point. We use the cleanup mechanism to ensure we * re-lock the mutex and decrement the waiters count * if we are canceled. */ - if (_pthread_sem_timedwait (&(cv->sema), abstime) == -1) + if (ptw32_sem_timedwait (&(cv->sema), abstime) == -1) { result = errno; } @@ -947,7 +947,7 @@ pthread_cond_broadcast (pthread_cond_t * cond) #ifdef NEED_SEM - result = (_pthread_increase_semaphore( &cv->sema, cv->waiters ) + result = (ptw32_increase_semaphore( &cv->sema, cv->waiters ) ? 0 : EINVAL); @@ -74,7 +74,7 @@ pthread_create (pthread_t * tid, ThreadParms *parms = NULL; long stackSize; - if ((thread = _pthread_new()) == NULL) + if ((thread = ptw32_new()) == NULL) { goto FAIL0; } @@ -141,7 +141,7 @@ pthread_create (pthread_t * tid, _beginthreadex ( (void *) NULL, /* No security info */ (unsigned) stackSize, /* default stack size */ - (unsigned (PT_STDCALL *) (void *)) _pthread_threadStart, + (unsigned (PT_STDCALL *) (void *)) ptw32_threadStart, parms, (unsigned) CREATE_SUSPENDED, (unsigned *) &(thread->thread)); @@ -161,7 +161,7 @@ pthread_create (pthread_t * tid, thread->threadH = threadH = (HANDLE) _beginthread ( - (void (PT_STDCALL *) (void *)) _pthread_threadStart, + (void (PT_STDCALL *) (void *)) ptw32_hreadStart, (unsigned) stackSize, /* default stack size */ parms); @@ -202,7 +202,7 @@ FAIL0: if (result != 0) { - _pthread_threadDestroy (thread); + ptw32_threadDestroy (thread); thread = NULL; if (parms != NULL) @@ -31,7 +31,7 @@ /* * Function pointer to TryEnterCriticalSection if it exists; otherwise NULL */ -BOOL (WINAPI *_pthread_try_enter_critical_section)(LPCRITICAL_SECTION) = NULL; +BOOL (WINAPI *ptw32_try_enter_critical_section)(LPCRITICAL_SECTION) = NULL; /* * We use this to double-check that TryEnterCriticalSection works. @@ -41,7 +41,7 @@ CRITICAL_SECTION cs; /* * Handle to kernel32.dll */ -static HINSTANCE _pthread_h_kernel32; +static HINSTANCE ptw32_h_kernel32; #ifdef _MSC_VER @@ -82,25 +82,25 @@ DllMain ( /* * The DLL is being mapped into the process's address space */ - result = _pthread_processInitialize (); + result = ptw32_rocessInitialize (); /* Load KERNEL32 and try to get address of TryEnterCriticalSection */ - _pthread_h_kernel32 = LoadLibrary(TEXT("KERNEL32.DLL")); - _pthread_try_enter_critical_section = + ptw32_h_kernel32 = LoadLibrary(TEXT("KERNEL32.DLL")); + ptw32_try_enter_critical_section = (BOOL (PT_STDCALL *)(LPCRITICAL_SECTION)) #if defined(NEED_UNICODE_CONSTS) - GetProcAddress(_pthread_h_kernel32, + GetProcAddress(ptw32_h_kernel32, (const TCHAR *)TEXT("TryEnterCriticalSection")); #else - GetProcAddress(_pthread_h_kernel32, + GetProcAddress(ptw32_h_kernel32, (LPCSTR) "TryEnterCriticalSection"); #endif - if (_pthread_try_enter_critical_section != NULL) + if (ptw32_try_enter_critical_section != NULL) { InitializeCriticalSection(&cs); - if ((*_pthread_try_enter_critical_section)(&cs)) + if ((*ptw32_try_enter_critical_section)(&cs)) { LeaveCriticalSection(&cs); } @@ -109,12 +109,12 @@ DllMain ( /* * Not really supported (Win98?). */ - _pthread_try_enter_critical_section = NULL; + ptw32_try_enter_critical_section = NULL; } DeleteCriticalSection(&cs); } - if (_pthread_try_enter_critical_section == NULL) + if (ptw32_try_enter_critical_section == NULL) { /* * If TryEnterCriticalSection is not being used, then free @@ -130,8 +130,8 @@ DllMain ( * provide TryEnterCriticalSection, the bug will be * effortlessly avoided. */ - (void) FreeLibrary(_pthread_h_kernel32); - _pthread_h_kernel32 = 0; + (void) FreeLibrary(ptw32_h_kernel32); + ptw32_h_kernel32 = 0; } break; @@ -152,9 +152,9 @@ DllMain ( { pthread_t self; - if (_pthread_processInitialized) + if (ptw32_processInitialized) { - self = (pthread_t) pthread_getspecific (_pthread_selfThreadKey); + self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey); /* * Detached threads have their resources automatically @@ -163,8 +163,8 @@ DllMain ( if (self != NULL && self->detachState == PTHREAD_CREATE_DETACHED) { - pthread_setspecific (_pthread_selfThreadKey, NULL); - _pthread_threadDestroy (self); + pthread_setspecific (ptw32_selfThreadKey, NULL); + ptw32_threadDestroy (self); } if (fdwReason == DLL_PROCESS_DETACH) @@ -172,11 +172,11 @@ DllMain ( /* * The DLL is being unmapped into the process's address space */ - _pthread_processTerminate (); + ptw32_processTerminate (); - if (_pthread_h_kernel32) + if (ptw32_h_kernel32) { - (void) FreeLibrary(_pthread_h_kernel32); + (void) FreeLibrary(ptw32_h_kernel32); } } } @@ -62,15 +62,15 @@ pthread_exit (void *value_ptr) /* If the current thread is implicit it was not started through pthread_create(), therefore we cleanup and end the thread here. Otherwise we raise an exception to unwind the exception - stack. The exception will be caught by _pthread_threadStart(), + stack. The exception will be caught by ptw32_threadStart(), which will cleanup and end the thread for us. */ - self = (pthread_t) pthread_getspecific (_pthread_selfThreadKey); + self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey); if (self == NULL || self->implicit) { - _pthread_callUserDestroyRoutines(self); + ptw32_allUserDestroyRoutines(self); #if ! defined (__MINGW32__) || defined (__MSVCRT__) _endthreadex ((unsigned) value_ptr); @@ -105,7 +105,7 @@ pthread_exit (void *value_ptr) (void) pthread_pop_cleanup( 1 ); - _pthread_callUserDestroyRoutines(self); + ptw32_callUserDestroyRoutines(self); #if ! defined (__MINGW32__) || defined (__MSVCRT__) _endthreadex ((unsigned) value_ptr); @@ -28,24 +28,24 @@ #include "implement.h" -int _pthread_processInitialized = FALSE; -pthread_key_t _pthread_selfThreadKey = NULL; -pthread_key_t _pthread_cleanupKey = NULL; +int ptw32_processInitialized = FALSE; +pthread_key_t ptw32_selfThreadKey = NULL; +pthread_key_t ptw32_leanupKey = NULL; /* * Global lock for testing internal state of PTHREAD_MUTEX_INITIALIZER * created mutexes. */ -CRITICAL_SECTION _pthread_mutex_test_init_lock; +CRITICAL_SECTION ptw32_mutex_test_init_lock; /* * Global lock for testing internal state of PTHREAD_COND_INITIALIZER * created condition variables. */ -CRITICAL_SECTION _pthread_cond_test_init_lock; +CRITICAL_SECTION ptw32_cond_test_init_lock; /* * Global lock for testing internal state of PTHREAD_RWLOCK_INITIALIZER * created read/write locks. */ -CRITICAL_SECTION _pthread_rwlock_test_init_lock; +CRITICAL_SECTION ptw32_rwlock_test_init_lock; diff --git a/implement.h b/implement.h index 3fc81b1..6cfcc75 100644 --- a/implement.h +++ b/implement.h @@ -322,20 +322,20 @@ struct ThreadKeyAssoc { #endif /* _MSC_VER */ /* Function pointer to TryEnterCriticalSection if it exists; otherwise NULL */ -extern BOOL (WINAPI *_pthread_try_enter_critical_section)(LPCRITICAL_SECTION); +extern BOOL (WINAPI *ptw32_try_enter_critical_section)(LPCRITICAL_SECTION); /* Declared in global.c */ -extern int _pthread_processInitialized; -extern pthread_key_t _pthread_selfThreadKey; -extern pthread_key_t _pthread_cleanupKey; -extern CRITICAL_SECTION _pthread_mutex_test_init_lock; -extern CRITICAL_SECTION _pthread_cond_test_init_lock; -extern CRITICAL_SECTION _pthread_rwlock_test_init_lock; +extern int ptw32_processInitialized; +extern pthread_key_t ptw32_elfThreadKey; +extern pthread_key_t ptw32_cleanupKey; +extern CRITICAL_SECTION ptw32_mutex_test_init_lock; +extern CRITICAL_SECTION ptw32_cond_test_init_lock; +extern CRITICAL_SECTION ptw32_rwlock_test_init_lock; /* Declared in misc.c */ #ifdef NEED_CALLOC -#define calloc(n, s) _pthread_calloc(n, s) -void *_pthread_calloc(size_t n, size_t s); +#define calloc(n, s) ptw32_calloc(n, s) +void *ptw32_calloc(size_t n, size_t s); #endif @@ -350,37 +350,37 @@ extern "C" { * ===================== * ===================== */ -int _pthread_processInitialize (void); +int ptw32_processInitialize (void); -void _pthread_processTerminate (void); +void ptw32_processTerminate (void); -void _pthread_threadDestroy (pthread_t tid); +void ptw32_threadDestroy (pthread_t tid); -void _pthread_cleanupStack (void); +void ptw32_cleanupStack (void); -pthread_t _pthread_new (void); +pthread_t ptw32_new (void); #if ! defined (__MINGW32__) || defined (__MSVCRT__) unsigned PT_STDCALL #else void #endif -_pthread_threadStart (ThreadParms * threadParms); +ptw32_threadStart (ThreadParms * threadParms); -void _pthread_callUserDestroyRoutines (pthread_t thread); +void ptw32_callUserDestroyRoutines (pthread_t thread); -int _pthread_tkAssocCreate (ThreadKeyAssoc ** assocP, +int ptw32_tkAssocCreate (ThreadKeyAssoc ** assocP, pthread_t thread, pthread_key_t key); -void _pthread_tkAssocDestroy (ThreadKeyAssoc * assoc); +void ptw32_tkAssocDestroy (ThreadKeyAssoc * assoc); -int _pthread_sem_timedwait (sem_t * sem, +int ptw32_sem_timedwait (sem_t * sem, const struct timespec * abstime); #ifdef NEED_SEM -void _pthread_decrease_semaphore(sem_t * sem); -BOOL _pthread_increase_semaphore(sem_t * sem, +void ptw32_decrease_semaphore(sem_t * sem); +BOOL ptw32_increase_semaphore(sem_t * sem, unsigned int n); #endif /* NEED_SEM */ @@ -147,14 +147,14 @@ pthread_self (void) * need to ensure there always is a self */ - if ((self = (pthread_t) pthread_getspecific (_pthread_selfThreadKey)) + if ((self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey)) == NULL) { /* * Need to create an implicit 'self' for the currently * executing thread. */ - self = _pthread_new(); + self = ptw32_new(); if (self != NULL) { @@ -195,7 +195,7 @@ pthread_self (void) #endif } - pthread_setspecific (_pthread_selfThreadKey, self); + pthread_setspecific (ptw32_elfThreadKey, self); } return (self); @@ -260,7 +260,7 @@ CancelableWait (HANDLE waitHandle, DWORD timeout) handles[0] = waitHandle; - if ((self = (pthread_t) pthread_getspecific (_pthread_selfThreadKey)) + if ((self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey)) != NULL) { /* @@ -381,7 +381,7 @@ pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout) pthread_t -_pthread_new (void) +ptw32_new (void) { pthread_t t; @@ -402,7 +402,7 @@ _pthread_new (void) #ifdef NEED_CALLOC void * -_pthread_calloc(size_t n, size_t s) { +ptw32_calloc(size_t n, size_t s) { unsigned int m = n*s; void *p; @@ -56,7 +56,7 @@ _mutex_check_need_init(pthread_mutex_t *mutex) * the number of processors + 1. * */ - EnterCriticalSection(&_pthread_mutex_test_init_lock); + EnterCriticalSection(&ptw32_mutex_test_init_lock); /* * We got here possibly under race @@ -80,7 +80,7 @@ _mutex_check_need_init(pthread_mutex_t *mutex) result = EINVAL; } - LeaveCriticalSection(&_pthread_mutex_test_init_lock); + LeaveCriticalSection(&ptw32_mutex_test_init_lock); return(result); } @@ -140,7 +140,7 @@ pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) } else { - if (_pthread_try_enter_critical_section != NULL + if (ptw32_ry_enter_critical_section != NULL || (attr != NULL && *attr != NULL && (*attr)->forcecs == 1) @@ -234,7 +234,7 @@ pthread_mutex_destroy(pthread_mutex_t *mutex) /* * See notes in _mutex_check_need_init() above also. */ - EnterCriticalSection(&_pthread_mutex_test_init_lock); + EnterCriticalSection(&ptw32_mutex_test_init_lock); /* * Check again. @@ -258,7 +258,7 @@ pthread_mutex_destroy(pthread_mutex_t *mutex) result = EBUSY; } - LeaveCriticalSection(&_pthread_mutex_test_init_lock); + LeaveCriticalSection(&ptw32_mutex_test_init_lock); } return(result); @@ -618,7 +618,7 @@ pthread_mutex_trylock(pthread_mutex_t *mutex) { if (mx->mutex == 0) { - if ((*_pthread_try_enter_critical_section)(&mx->cs) != TRUE) + if ((*ptw32_try_enter_critical_section)(&mx->cs) != TRUE) { result = EBUSY; } @@ -39,7 +39,7 @@ int -_pthread_processInitialize (void) +ptw32_processInitialize (void) /* * ------------------------------------------------------ * DOCPRIVATE @@ -53,7 +53,7 @@ _pthread_processInitialize (void) * This function performs process wide initialization for * the pthread library. * If successful, this routine sets the global variable - * _pthread_processInitialized to TRUE. + * ptw32_processInitialized to TRUE. * * RESULTS * TRUE if successful, @@ -62,42 +62,42 @@ _pthread_processInitialize (void) * ------------------------------------------------------ */ { - if (_pthread_processInitialized) { + if (ptw32_rocessInitialized) { /* * ignore if already initialized. this is useful for * programs that uses a non-dll pthread - * library. such programs must call _pthread_processInitialize() explicitely, + * library. such programs must call ptw32_processInitialize() explicitely, * since this initialization routine is automatically called only when * the dll is loaded. */ return TRUE; } - _pthread_processInitialized = TRUE; + ptw32_processInitialized = TRUE; /* * Initialize Keys */ - if ((pthread_key_create (&_pthread_selfThreadKey, NULL) != 0) || - (pthread_key_create (&_pthread_cleanupKey, NULL) != 0)) + if ((pthread_key_create (&ptw32_selfThreadKey, NULL) != 0) || + (pthread_key_create (&ptw32_cleanupKey, NULL) != 0)) { - _pthread_processTerminate (); + ptw32_processTerminate (); } /* * Set up the global test and init check locks. */ - InitializeCriticalSection(&_pthread_mutex_test_init_lock); - InitializeCriticalSection(&_pthread_cond_test_init_lock); - InitializeCriticalSection(&_pthread_rwlock_test_init_lock); + InitializeCriticalSection(&ptw32_mutex_test_init_lock); + InitializeCriticalSection(&ptw32_cond_test_init_lock); + InitializeCriticalSection(&ptw32_rwlock_test_init_lock); - return (_pthread_processInitialized); + return (ptw32_processInitialized); } /* processInitialize */ void -_pthread_processTerminate (void) +ptw32_processTerminate (void) /* * ------------------------------------------------------ * DOCPRIVATE @@ -111,7 +111,7 @@ _pthread_processTerminate (void) * This function performs process wide termination for * the pthread library. * This routine sets the global variable - * _pthread_processInitialized to FALSE + * ptw32_processInitialized to FALSE * * RESULTS * N/A @@ -119,37 +119,37 @@ _pthread_processTerminate (void) * ------------------------------------------------------ */ { - if (_pthread_processInitialized) + if (ptw32_processInitialized) { - if (_pthread_selfThreadKey != NULL) + if (ptw32_selfThreadKey != NULL) { /* - * Release _pthread_selfThreadKey + * Release ptw32_selfThreadKey */ - pthread_key_delete (_pthread_selfThreadKey); + pthread_key_delete (ptw32_selfThreadKey); - _pthread_selfThreadKey = NULL; + ptw32_selfThreadKey = NULL; } - if (_pthread_cleanupKey != NULL) + if (ptw32_cleanupKey != NULL) { /* - * Release _pthread_cleanupKey + * Release ptw32_cleanupKey */ - pthread_key_delete (_pthread_cleanupKey); + pthread_key_delete (ptw32_cleanupKey); - _pthread_cleanupKey = NULL; + ptw32_cleanupKey = NULL; } /* * Destroy the global test and init check locks. */ - DeleteCriticalSection(&_pthread_rwlock_test_init_lock); - DeleteCriticalSection(&_pthread_cond_test_init_lock); - DeleteCriticalSection(&_pthread_mutex_test_init_lock); + DeleteCriticalSection(&ptw32_rwlock_test_init_lock); + DeleteCriticalSection(&ptw32_cond_test_init_lock); + DeleteCriticalSection(&ptw32_mutex_test_init_lock); - _pthread_processInitialized = FALSE; + ptw32_processInitialized = FALSE; } } /* processTerminate */ @@ -179,7 +179,7 @@ unsigned PT_STDCALL #else void #endif -_pthread_threadStart (ThreadParms * threadParms) +ptw32_threadStart (ThreadParms * threadParms) { pthread_t self; void *(*start) (void *); @@ -212,7 +212,7 @@ _pthread_threadStart (ThreadParms * threadParms) } #endif - pthread_setspecific (_pthread_selfThreadKey, self); + pthread_setspecific (ptw32_selfThreadKey, self); #if defined(_MSC_VER) && !defined(__cplusplus) @@ -301,7 +301,7 @@ _pthread_threadStart (ThreadParms * threadParms) #endif /* _MSC_VER */ (void) pthread_mutex_destroy(&self->cancelLock); - _pthread_callUserDestroyRoutines(self); + ptw32_callUserDestroyRoutines(self); #if ! defined (__MINGW32__) || defined (__MSVCRT__) _endthreadex ((unsigned) status); @@ -317,14 +317,14 @@ _pthread_threadStart (ThreadParms * threadParms) return (unsigned) status; #endif -} /* _pthread_threadStart */ +} /* ptw32_threadStart */ void -_pthread_threadDestroy (pthread_t thread) +ptw32_threadDestroy (pthread_t thread) { if (thread != NULL) { - _pthread_callUserDestroyRoutines (thread); + ptw32_callUserDestroyRoutines (thread); if (thread->cancelEvent != NULL) { @@ -342,10 +342,10 @@ _pthread_threadDestroy (pthread_t thread) free (thread); } -} /* _pthread_threadDestroy */ +} /* ptw32_threadDestroy */ int -_pthread_tkAssocCreate (ThreadKeyAssoc ** assocP, +ptw32_tkAssocCreate (ThreadKeyAssoc ** assocP, pthread_t thread, pthread_key_t key) /* @@ -361,7 +361,7 @@ _pthread_tkAssocCreate (ThreadKeyAssoc ** assocP, * * Notes: * 1) New associations are pushed to the beginning of the - * chain so that the internal _pthread_selfThreadKey association + * chain so that the internal ptw32_selfThreadKey association * is always last, thus allowing selfThreadExit to * be implicitly called by pthread_exit last. * @@ -448,11 +448,11 @@ FAIL0: return (result); -} /* _pthread_tkAssocCreate */ +} /* ptw32_tkAssocCreate */ void -_pthread_tkAssocDestroy (ThreadKeyAssoc * assoc) +ptw32_tkAssocDestroy (ThreadKeyAssoc * assoc) /* * ------------------------------------------------------------------- * This routine releases all resources for the given ThreadKeyAssoc @@ -477,11 +477,11 @@ _pthread_tkAssocDestroy (ThreadKeyAssoc * assoc) free (assoc); } -} /* _pthread_tkAssocDestroy */ +} /* ptw32_tkAssocDestroy */ void -_pthread_callUserDestroyRoutines (pthread_t thread) +ptw32_callUserDestroyRoutines (pthread_t thread) /* * ------------------------------------------------------------------- * DOCPRIVATE @@ -601,14 +601,14 @@ _pthread_callUserDestroyRoutines (pthread_t thread) pthread_mutex_unlock (&(assoc->lock)); - _pthread_tkAssocDestroy (assoc); + ptw32_tkAssocDestroy (assoc); assoc = *nextP; } } } -} /* _pthread_callUserDestroyRoutines */ +} /* ptw32_callUserDestroyRoutines */ @@ -652,7 +652,7 @@ filetime_to_timespec(const FILETIME *ft, struct timespec *ts) #endif /* NEED_FTIME */ int -_pthread_sem_timedwait (sem_t * sem, const struct timespec * abstime) +ptw32_sem_timedwait (sem_t * sem, const struct timespec * abstime) /* * ------------------------------------------------------ * DOCPUBLIC @@ -786,17 +786,17 @@ _pthread_sem_timedwait (sem_t * sem, const struct timespec * abstime) #ifdef NEED_SEM - _pthread_decrease_semaphore(sem); + ptw32_decrease_semaphore(sem); #endif /* NEED_SEM */ return 0; -} /* _pthread_sem_timedwait */ +} /* ptw32_sem_timedwait */ DWORD -_pthread_get_exception_services_code(void) +ptw32_get_exception_services_code(void) { #if defined(_MSC_VER) && !defined(__cplusplus) diff --git a/pthread.def b/pthread.def index 9f9d836..9ddf1a5 100644 --- a/pthread.def +++ b/pthread.def @@ -1,12 +1,12 @@ ; pthread.def
-; Last updated: $Date: 2000/08/14 03:43:09 $
+; Last updated: $Date: 2000/08/17 10:18:36 $
; Currently unimplemented functions are commented out.
;LIBRARY pthread
EXPORTS
-_pthread_processInitialize
+ptw32_processInitialize
;pthread_atfork
pthread_attr_destroy
pthread_attr_getdetachstate
@@ -113,4 +113,4 @@ pthread_pop_cleanup ; Not for use directly. Needed by macros in pthread.h
; to return internal SEH code.
;
-_pthread_get_exception_services_code
+ptw32_get_exception_services_code
@@ -581,14 +581,14 @@ struct sched_param { * C++ and C built versions will not. */ -typedef struct _pthread_cleanup_t _pthread_cleanup_t; +typedef struct ptw32_cleanup_t ptw32_cleanup_t; -struct _pthread_cleanup_t +struct ptw32_cleanup_t { void (*routine) (void *); void *arg; #if !defined(_MSC_VER) && !defined(__cplusplus) - _pthread_cleanup_t *prev; + ptw32_leanup_t *prev; #endif /* !_MSC_VER && ! __cplusplus */ }; @@ -599,7 +599,7 @@ struct _pthread_cleanup_t #define pthread_cleanup_push( _rout, _arg ) \ { \ - _pthread_cleanup_t _cleanup; \ + ptw32_cleanup_t _cleanup; \ \ _cleanup.routine = (_rout); \ _cleanup.arg = (_arg); \ @@ -627,7 +627,7 @@ struct _pthread_cleanup_t #define pthread_cleanup_push( _rout, _arg ) \ { \ - _pthread_cleanup_t _cleanup; \ + ptw32_cleanup_t _cleanup; \ \ pthread_push_cleanup( &_cleanup, (_rout), (_arg) ); \ @@ -787,9 +787,9 @@ void pthread_testcancel (void); int pthread_once (pthread_once_t * once_control, void (*init_routine) (void)); -_pthread_cleanup_t *pthread_pop_cleanup (int execute); +ptw32_cleanup_t *pthread_pop_cleanup (int execute); -void pthread_push_cleanup (_pthread_cleanup_t * cleanup, +void pthread_push_cleanup (ptw32_cleanup_t * cleanup, void (*routine) (void *), void *arg); @@ -970,7 +970,7 @@ int * _errno( void ); /* * Get internal SEH tag */ -DWORD _pthread_get_exception_services_code(void); +DWORD ptw32_get_exception_services_code(void); #if defined(_MSC_VER) && !defined(__cplusplus) @@ -979,7 +979,7 @@ DWORD _pthread_get_exception_services_code(void); * propagate our internal exceptions up to the library's internal handlers. */ #define __except( E ) \ - __except( ( GetExceptionCode() == _pthread_get_exception_services_code() ) \ + __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \ ? EXCEPTION_CONTINUE_SEARCH : ( E ) ) #endif /* _MSC_VER && ! __cplusplus */ @@ -54,7 +54,7 @@ _rwlock_check_need_init(pthread_rwlock_t *rwlock) * the number of processors + 1. * */ - EnterCriticalSection(&_pthread_rwlock_test_init_lock); + EnterCriticalSection(&ptw32_rwlock_test_init_lock); /* * We got here possibly under race @@ -78,7 +78,7 @@ _rwlock_check_need_init(pthread_rwlock_t *rwlock) result = EINVAL; } - LeaveCriticalSection(&_pthread_rwlock_test_init_lock); + LeaveCriticalSection(&ptw32_rwlock_test_init_lock); return(result); } @@ -197,7 +197,7 @@ pthread_rwlock_destroy(pthread_rwlock_t *rwlock) /* * See notes in _rwlock_check_need_init() above also. */ - EnterCriticalSection(&_pthread_rwlock_test_init_lock); + EnterCriticalSection(&ptw32_wlock_test_init_lock); /* * Check again. @@ -221,7 +221,7 @@ pthread_rwlock_destroy(pthread_rwlock_t *rwlock) result = EBUSY; } - LeaveCriticalSection(&_pthread_rwlock_test_init_lock); + LeaveCriticalSection(&ptw32_rwlock_test_init_lock); } return(result); diff --git a/semaphore.c b/semaphore.c index a8c346e..366c2de 100644 --- a/semaphore.c +++ b/semaphore.c @@ -278,7 +278,7 @@ sem_trywait (sem_t * sem) #ifdef NEED_SEM void -_pthread_decrease_semaphore(sem_t * sem) +ptw32_decrease_semaphore(sem_t * sem) { pthread_mutex_lock(&sem->mutex); @@ -299,7 +299,7 @@ _pthread_decrease_semaphore(sem_t * sem) } BOOL -_pthread_increase_semaphore(sem_t * sem, unsigned int n) +ptw32_increase_semaphore(sem_t * sem, unsigned int n) { BOOL result; @@ -154,7 +154,7 @@ pthread_join (pthread_t thread, void **value_ptr) * The result of making multiple simultaneous calls to * pthread_join() specifying the same target is undefined. */ - _pthread_threadDestroy (thread); + ptw32_threadDestroy (thread); } #else /* __MINGW32__ && ! __MSVCRT__ */ @@ -172,7 +172,7 @@ pthread_join (pthread_t thread, void **value_ptr) * The result of making multiple simultaneous calls to * pthread_join() specifying the same target is undefined. */ - _pthread_threadDestroy (thread); + ptw32_threadDestroy (thread); #endif /* __MINGW32__ && ! __MSVCRT__ */ @@ -160,7 +160,7 @@ pthread_key_delete (pthread_key_t key) pthread_mutex_unlock (&(assoc->lock)); - _pthread_tkAssocDestroy (assoc); + ptw32_tkAssocDestroy (assoc); assoc = next; } @@ -214,7 +214,7 @@ pthread_setspecific (pthread_key_t key, const void *value) pthread_t self; int result = 0; - if (key != _pthread_selfThreadKey) + if (key != ptw32_selfThreadKey) { /* * Using pthread_self will implicitly create @@ -233,7 +233,7 @@ pthread_setspecific (pthread_key_t key, const void *value) * Resolve catch-22 of registering thread with threadSelf * key */ - self = (pthread_t) pthread_getspecific (_pthread_selfThreadKey); + self = (pthread_t) pthread_getspecific (ptw32_elfThreadKey); if (self == NULL) { self = (pthread_t) value; @@ -280,7 +280,7 @@ pthread_setspecific (pthread_key_t key, const void *value) */ if (assoc == NULL) { - result = _pthread_tkAssocCreate (&assoc, self, key); + result = ptw32_tkAssocCreate (&assoc, self, key); } } |