summaryrefslogtreecommitdiff
path: root/exit.c
AgeCommit message (Collapse)Author
1999-01-03Mon Jan 4 11:23:40 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>bossom-merge-99-01-04bossom-merge-98-12-08rpj
* all: No code changes, just cleanup. - remove #if 0 /* Pre Bossom */ enclosed code. - Remove some redundant #includes. * pthread.h: Update implemented/unimplemented routines list. * Tag the bossom merge branch getting ready to merge back to main trunk.
1998-12-22Sun Dec 20 14:51:58 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* misc.c (pthreadCancelableWait): New function by John Bossom. Non-stand ard but provides a hook that can be used to implement cancellation points in applications that use this library. * pthread.h (pthread_cleanup_pop): C++ (non-WIN32) version uses try/catch to emulate John Bossom's WIN32 __try/__finally behaviour. In the WIN32 version __finally block, add a test for AbnormalTermination otherwise cleanup is only run if the cleanup_pop execute arg is non-zero. Cancella tion should cause the cleanup to run irrespective of the execute arg. * condvar.c (pthread_condattr_init): Replaced by John Bossom's version. (pthread_condattr_destroy): Replaced by John Bossom's version. (pthread_condattr_getpshared): Replaced by John Bossom's version. (pthread_condattr_setpshared): Replaced by John Bossom's version. (pthread_cond_init): Replaced by John Bossom's version. Fix comment (refered to mutex rather than condition variable). (pthread_cond_destroy): Replaced by John Bossom's version. (pthread_cond_wait): Replaced by John Bossom's version. (pthread_cond_timedwait): Replaced by John Bossom's version. (pthread_cond_signal): Replaced by John Bossom's version. (pthread_cond_broadcast): Replaced by John Bossom's version. Thu Dec 17 19:10:46 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * tsd.c (pthread_key_create): Replaced by John Bossom's version. (pthread_key_delete): Replaced by John Bossom's version. (pthread_setspecific): Replaced by John Bossom's version. (pthread_getspecific): Replaced by John Bossom's version. Mon Dec 7 09:44:40 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * cancel.c (pthread_setcancelstate): Replaced by John Bossom's version. (pthread_setcanceltype): Replaced by John Bossom's version. (pthread_testcancel): Replaced by John Bossom's version. (pthread_cancel): Replaced by John Bossom's version. * exit.c (pthread_exit): Replaced by John Bossom's version. * misc.c (pthread_self): Replaced by John Bossom's version. (pthread_equal): Replaced by John Bossom's version. * sync.c (pthread_detach): Replaced by John Bossom's version. (pthread_join): Replaced by John Bossom's version. * 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. * implement.h: Added John Bossom's non-API structures and declarations. * dll.c (PthreadsEntryPoint): Cast return value of GetProcAddress to resolve compile warning from MSVC. * 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 and release kernel32 handle when DLL is being unloaded.
1998-10-14Wed Oct 14 21:09:24 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* private.c (_pthread_new_thread): Increment _pthread_threads_count. (_pthread_delete_thread): Decrement _pthread_threads_count. Remove some comments. * exit.c (_pthread_exit): : Fix two pthread_mutex_lock() calls that should have been pthread_mutex_unlock() calls. (_pthread_vacuum): Remove call to _pthread_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. * tsd.c (pthread_key_create): Add critical section. (pthread_setspecific): Ditto. (pthread_getspecific): Ditto. (pthread_key_delete): Ditto. * sync.c (pthread_join): Fix two pthread_mutex_lock() calls that should have been pthread_mutex_unlock() calls.
1998-08-06*** empty log message ***rpj
1998-08-03Tue Aug 4 00:09:30 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* 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. * global.c (_pthread_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. * 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. * exit.c: Add windows.h and process.h includes. (_pthread_exit): Add local detachstate declaration. (_pthread_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. * process.h: Create. * windows.h: Move _beginthreadex and _endthreadex into process.h Mon Aug 3 21:19:57 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * condvar.c (pthread_cond_init): Add NULL attr to pthread_mutex_init() call - default attributes will be used. (cond_wait): Fix typo. (cond_wait): Fix typo - cv was ev. (pthread_cond_broadcast): Fix two identical typos. * cleanup.c (_pthread_destructor_pop_all): Remove _ prefix from PTHREAD_DESTRUCTOR_ITERATIONS. * pthread.h: Move _POSIX_* values into posix.h * pthread.h: Fix typo in pthread_mutex_init() prototype. * attr.c (pthread_attr_init): Fix error in priority member init. * windows.h (THREAD_PRIORITY_NORMAL): Add. * pthread.h (sched_param): Add missing ';' to struct definition. * attr.c (pthread_attr_init): Remove obsolete pthread_attr_t member initialisation - cancelstate, canceltype, cancel_pending. (is_attr): Make arg "attr" a const. * 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.
1998-07-31Fri Jul 31 00:05:45 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* tsd.c (pthread_key_create): Update to properly associate the destructor routine with the key. * exit.c (_pthread_vacuum): Add call to _pthread_destructor_pop_all().
1998-07-28Tue Jul 28 14:04:29 1998 Ross Johnson <rpj@swan.canberra.edu.au>rpj
* 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". Remove extra local variable "target". (pthread_detach): Ditto. * signal.c (pthread_sigmask): Move init of "us" out of inner block. Fix instance of "this" should have been "us". Rename "us" to "thread". * sched.c (pthread_setschedparam): Modify to use the new thread type. (pthread_getschedparam): Ditto. * private.c (_pthread_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. ( _PTHREAD_NEW, _PTHREAD_INUSE, _PTHREAD_EXITED, _PTHREAD_REUSE): Add. * create.c (pthread_create): Minor rename "us" to "new" (I need these cues but it doesn't stop me coming out with some major bugs at times). Load start_routine and arg into the thread so the wrapper can call it. * 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 pthread_this(). (pthread_setcanceltype): Ditto.
1998-07-28Tue Jul 28 14:04:29 1998 Ross Johnson <rpj@swan.canberra.edu.au>rpj
* exit.c (_pthread_exit): Add new pthread_t arg. Rename _pthread_delete_thread_entry to _pthread_delete_thread. Rename "us" to "thread". (pthread_exit): Call _pthread_exit with added thread arg.
1998-07-26Mon Jul 27 00:20:37 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* private.c (_pthread_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. * implement.h (_pthread_call_t): Remove env member.
1998-07-26Sun Jul 26 13:06:12 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* exit.c (_pthread_exit): Clarify comment.
1998-07-26Sun Jul 26 13:06:12 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* exit.c (_pthread_exit): Move thread entry delete call from _pthread_vacuum() into here. Add more explanation of thread entry deletion.
1998-07-26Sun Jul 26 13:06:12 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* exit.c (_pthread_exit): New function. Called from pthread_exit() and _pthread_start_call() to exit the thread. It allows an extra argument which is the return code passed to _endthreadex(). * create.c (_pthread_start_call): Change pthread_exit() call to _pthread_exit() call.
1998-07-26Sun Jul 26 13:06:12 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* exit.c (_pthread_vacuum): Add thread entry deletion code moved from _pthread_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 cleanup code out. Call pthread_exit(NULL) to terminate the thread.
1998-07-25Sun Jul 26 00:09:59 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* condvar.c (cond_wait): Add cancelation point. This applies the point to both pthread_cond_wait() and pthread_cond_timedwait(). * exit.c (pthread_exit): Rename "this" to "us". * implement.h: Add comment. * sync.c (pthread_join): I've satisfied myself that pthread_detach() does set the detached attribute in the thread entry attributes to PTHREAD_CREATE_DETACHED. "if" conditions were changed to test that attribute instead of a separate flag. * create.c (pthread_create): Rename "this" to "us". (pthread_create): cancelstate and canceltype are not attributes so the copy to thread entry attribute storage was removed. Only the thread itself can change it's cancelstate or canceltype, ie. the thread must exist already.
1998-07-25Sat Jul 25 00:00:13 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* create.c (_pthread_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 thread is created PTHREAD_CREATE_DETACHED. * pthread.h (pthread_attr_t): Rename member "detachedstate". * attr.c (pthread_attr_init): Rename attr members. * exit.c (pthread_exit): Fix indirection mistake. * implement.h (_PTHREAD_THREADS_TABLE_INDEX): Add. * exit.c (_pthread_vacuum): Fix incorrect args to _pthread_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. * implement.h (_pthread_once_flag): Remove. (_pthread_once_lock): Ditto. (_pthread_threads_mutex_table): Add. * global.c (_pthread_once_flag): Remove. (_pthread_once_lock): Ditto. * sync.c (pthread_join): Fix tests involving new return value from _pthread_find_thread_entry(). (pthread_detach): Ditto. * private.c (_pthread_find_thread_entry): Failure return code changed from -1 to NULL.
1998-07-24Fri Jul 24 21:13:55 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* cancel.c (pthread_cancel): Implement. (pthread_testcancel): Implement. * exit.c (pthread_exit): Add comment explaining the longjmp(). * implement.h (_pthread_threads_thread_t): New member cancelthread. (_PTHREAD_YES): Define. (_PTHREAD_NO): Define. (RND_SIZEOF): Remove. * create.c (pthread_create): Rename cancelability to cancelstate. * pthread.h (pthread_attr_t): Rename cancelability to cancelstate. (PTHREAD_CANCELED): Define.
1998-07-24 * sync.c (pthread_join): Save valueptr arg in joinvalueptr forrpj
pthread_exit() to use. * private.c (_pthread_new_thread_entry): Initialise joinvalueptr to NULL. * create.c (_pthread_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 void ** joinvalueptr. (_pthread_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().
1998-07-22Wed Jul 22 00:16:22 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* 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. 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. * cleanup.c (_pthread_handler_push, _pthread_handler_pop, _pthread_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 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() as well. * implement.h: Various additions and minor changes. * pthread.h: Various additions and minor changes. Change cleanup handler macros to use generic handler push and pop functions. * attr.c: Minor mods to all functions. (is_attr): Implemented missing function. * create.c (pthread_create): More clean up. * private.c (_pthread_find_thread_entry): Implement. (_pthread_delete_thread_entry): Implement. (_pthread_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. * exit.c (pthread_exit): Changed to use the new code above. * pthread.h: Add cancelability constants. Update comments.
1998-07-21Wed Jul 22 00:16:22 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* cleanup.c (_pthread_cleanup_push): Implement. (_pthread_cleanup_pop): Implement. (_pthread_do_cancellation): Implement. These are private to the implementation. The real cleanup functions are macros. See below. * pthread.h (pthread_cleanup_push): Implement as a macro. (pthread_cleanup_pop): Implement as a macro. Because these are macros which start and end a block, the POSIX scoping requirement is observed. See the comment in the file. * exit.c (pthread_exit): Refine the code. * create.c (pthread_create): Code cleanup. * implement.h (RND_SIZEOF): Add RND_SIZEOF(T) to round sizeof(T) up to multiple of DWORD. Add function prototypes. * private.c (_pthread_getthreadindex): "*thread" should have been "thread". Detect empty slot fail condition.
1998-07-19Mon Jul 20 02:31:05 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>rpj
* private.c (_pthread_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 and _PTHREAD_HASH_INDEX. * exit.c (pthread_exit): Begin work on cleanup and de-allocate thread-private storage. * create.c (pthread_create): Add thread to thread table. Keep a thread-private copy of the attributes with default values filled in when necessary. Same for the cleanup stack. Make pthread_create C run-time library friendly by using _beginthreadex() instead of CreateThread(). Fix error returns. 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. * create.c: Rename pthreads_thread_count to _pthread_threads_count. (pthread_create): Handle errors from CreateThread().
1998-07-10 * exit.c: Tidy function signature.bje
1998-07-101998-07-10 Ben Elliston <bje@cygnus.com>bje
* exit.c (pthread_exit): Implement.