From 007276b30e0a838084eda5c2ac0ba6b9b3243a15 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Mon, 10 Jun 2002 01:10:45 +0000 Subject: 2002-06-10 Robert Collins * cygwin.din: Add _pthread_cleanup_push and _pthread_cleanup_pop. * pthread.cc: Change __pthread_self to pthread::self() thruoghout. (_pthread_cleanup_push): New function. (_pthread_cleanup_pop): Ditto. * thread.cc: Thanks to Thomas Pfaff for the pthread cleanup_push,_pop patch, this work is derived from that. Change __pthread_self to pthread::self() thruoghout. (__pthread_self): Rename to pthread::self. (pthread::self): New method. (pthread::pthread): Initialize new member. (pthread::push_cleanup_handler): New method. (pthread::pop_cleanup_handler): New method. (pthread::pop_all_cleanup_handlers): New method. (__pthread_exit): Pop all cleanup handlers. * thread.h (pthread::push_cleanup_handler): Declare. (pthread::pop_cleanup_handler): Ditto. (pthread::pop_all_cleanup_handlers): Ditto. (pthread::self): New static method. (__pthread_exit): Give C++ linkage. (__pthread_join): Ditto. (__pthread_detach): Ditto. (__pthread_self): Remove. 2002-04-24 Thomas Pfaff * include/pthread.h (__pthread_cleanup_handler): New structure (pthread_cleanup_push): Rewritten . (pthread_cleanup_pop): Ditto. (_pthread_cleanup_push): New prototype. (_pthread_cleanup_pop) Ditto. 2002-04-24 Thomas Pfaff * thread.cc (thread_init_wrapper): Check if thread is already joined. (__pthread_join): Set joiner first. (__pthread_detach): Ditto. --- winsup/cygwin/pthread.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'winsup/cygwin/pthread.cc') diff --git a/winsup/cygwin/pthread.cc b/winsup/cygwin/pthread.cc index 7d8ca1ae6..ab7fd1fbe 100644 --- a/winsup/cygwin/pthread.cc +++ b/winsup/cygwin/pthread.cc @@ -218,7 +218,7 @@ pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set) pthread_t pthread_self () { - return __pthread_self (); + return pthread::self(); } int @@ -425,8 +425,6 @@ pthread_cancel (pthread_t thread) return __pthread_cancel (thread); } - - int pthread_setcancelstate (int state, int *oldstate) { @@ -445,6 +443,18 @@ pthread_testcancel (void) __pthread_testcancel (); } +void +_pthread_cleanup_push (__pthread_cleanup_handler *handler) +{ + pthread::self()->push_cleanup_handler(handler); +} + +void +_pthread_cleanup_pop (int execute) +{ + pthread::self()->pop_cleanup_handler (execute); +} + /* Semaphores */ int sem_init (sem_t * sem, int pshared, unsigned int value) -- cgit v1.2.3