From 5e87a0d9bdd4c2c2ab0e45a6379b4df0f1471ffa Mon Sep 17 00:00:00 2001 From: rpj Date: Thu, 19 Aug 1999 05:26:02 +0000 Subject: 1999-08-19 Ross Johnson * private.c (_pthread_threadStart): Return exit status from the application thread startup routine. - Milan Gardian 1999-08-18 Ross Johnson * exit.c (pthread_exit): Put status into pthread_t->exitStatus - John Bossom * private.c (_pthread_threadStart): Set pthread->exitStatus on exit of try{} block. - John Bossom * sync.c (pthread_join): use pthread_exitStatus value if the thread exit doesn't return a value (for Mingw32 CRTDLL which uses endthread instead of _endthreadex). - John Bossom Tue Aug 17 20:17:58 CDT 1999 Mumit Khan * create.c (pthread_create): Add CRTDLL suppport. * exit.c (pthread_exit): Likewise. * private.c (_pthread_threadStart): Likewise. (_pthread_threadDestroy): Likewise. * sync.c (pthread_join): Likewise. * tests/join1.c (main): Warn about partial support for CRTDLL. Tue Aug 17 20:00:08 1999 Mumit Khan * Makefile.in (LD): Delete entry point. * acconfig.h (STDCALL): Delete unused macro. * configure.in: Remove test for STDCALL. * config.h.in: Regenerate. * 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. 1999-08-14 Ross Johnson * exit.c (pthread_exit): Don't call pthread_self() but get thread handle directly from TSD for efficiency. --- sync.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'sync.c') diff --git a/sync.c b/sync.c index ac4c11f..06dffd9 100644 --- a/sync.c +++ b/sync.c @@ -128,6 +128,8 @@ pthread_join (pthread_t thread, void **value_ptr) stat = WaitForSingleObject (thread->threadH, INFINITE); +#if ! defined (__MINGW32__) || defined (__MSVCRT__) + if (stat == WAIT_OBJECT_0) { if (value_ptr != NULL @@ -148,6 +150,23 @@ pthread_join (pthread_t thread, void **value_ptr) { result = ESRCH; } + +#else /* __MINGW32__ && ! __MSVCRT__ */ + + /* + * If using CRTDLL, the thread may have exited, and endthread + * will have closed the handle. + */ + if (value_ptr != NULL) + *value_ptr = self->exitStatus; + + /* + * The result of making multiple simultaneous calls to + * pthread_join() specifying the same target is undefined. + */ + _pthread_threadDestroy (thread); + +#endif /* __MINGW32__ && ! __MSVCRT__ */ } return (result); -- cgit v1.2.3