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/thread.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'winsup/cygwin/thread.h') diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h index b71c3a31b..25f20b482 100644 --- a/winsup/cygwin/thread.h +++ b/winsup/cygwin/thread.h @@ -260,8 +260,17 @@ public: pthread (); ~pthread (); + void push_cleanup_handler (__pthread_cleanup_handler *handler); + void pop_cleanup_handler (int const execute); + + static pthread* self (); + private: DWORD thread_id; + __pthread_cleanup_handler *cleanup_handlers; + + friend void __pthread_exit (void *value_ptr); + void pop_all_cleanup_handlers (void); }; class pthread_mutexattr:public verifyable_object @@ -394,6 +403,11 @@ void __pthread_atforkprepare(void); void __pthread_atforkparent(void); void __pthread_atforkchild(void); +/* Thread Exit */ +void __pthread_exit (void *value_ptr); +int __pthread_join (pthread_t * thread, void **return_val); +int __pthread_detach (pthread_t * thread); + extern "C" { void *thread_init_wrapper (void *); @@ -424,15 +438,7 @@ int __pthread_attr_setschedpolicy (pthread_attr_t *, int); int __pthread_attr_setscope (pthread_attr_t *, int); int __pthread_attr_setstackaddr (pthread_attr_t *, void *); - - -/* Thread Exit */ -void __pthread_exit (void *value_ptr); -int __pthread_join (pthread_t * thread, void **return_val); -int __pthread_detach (pthread_t * thread); - /* Thread suspend */ - int __pthread_suspend (pthread_t * thread); int __pthread_continue (pthread_t * thread); @@ -462,10 +468,8 @@ int __pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set); /* ID */ -pthread_t __pthread_self (); int __pthread_equal (pthread_t * t1, pthread_t * t2); - /* Mutexes */ int __pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *); int __pthread_mutex_lock (pthread_mutex_t *); @@ -504,7 +508,6 @@ int __pthread_setcancelstate (int state, int *oldstate); int __pthread_setcanceltype (int type, int *oldtype); void __pthread_testcancel (void); - /* Semaphores */ int __sem_init (sem_t * sem, int pshared, unsigned int value); int __sem_destroy (sem_t * sem); -- cgit v1.2.3