summaryrefslogtreecommitdiff
path: root/exit.c
diff options
context:
space:
mode:
authorrpj <rpj>1998-07-24 03:58:18 +0000
committerrpj <rpj>1998-07-24 03:58:18 +0000
commit0c57f42f9e1bd459a95596b4d70e06f9a7b31148 (patch)
tree8788724fc18cc2c083f589b361562606558b2608 /exit.c
parente4f6e6fbec7ea7b7a7c358ed0167672714bf991e (diff)
* sync.c (pthread_join): Save valueptr arg in joinvalueptr for
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().
Diffstat (limited to 'exit.c')
-rw-r--r--exit.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/exit.c b/exit.c
index a9c352c..1e07ccd 100644
--- a/exit.c
+++ b/exit.c
@@ -36,6 +36,17 @@ _pthread_vacuum(void)
void
pthread_exit(void * value)
{
- _pthread_vacuum();
- _endthreadex((DWORD) value);
+ _pthread_threads_thread_t * this;
+
+ this = _PTHREAD_THIS;
+
+ if (this->joinvalueptr != NULL)
+ {
+ *(this->joinvalueptr) = value;
+ }
+
+ /* FIXME: More to do here. IE, if pthread_detach() was called
+ and value != NULL, do we free(value)? */
+
+ longjmp(this->call.env, 1);
}