diff options
author | rpj <rpj> | 1998-07-26 14:49:34 +0000 |
---|---|---|
committer | rpj <rpj> | 1998-07-26 14:49:34 +0000 |
commit | 537fe68bc5ca2dd75f4f54146a50a39c5b55b8e3 (patch) | |
tree | 25adc4da03898e307d43f8dcc3450b3b5260c867 | |
parent | 779359d2cf050c2885a05b81774b87b82466a471 (diff) |
Mon Jul 27 00:20:37 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* 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.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | attr.c | 9 | ||||
-rw-r--r-- | exit.c | 3 | ||||
-rw-r--r-- | implement.h | 3 | ||||
-rw-r--r-- | private.c | 3 |
5 files changed, 23 insertions, 8 deletions
@@ -1,3 +1,16 @@ +Mon Jul 27 00:20:37 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> + + * 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. + Sun Jul 26 13:06:12 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * implement.h (_pthread_new_thread_entry): Fix prototype. @@ -100,13 +100,14 @@ pthread_attr_init(pthread_attr_t *attr) attr->cancelstate = PTHREAD_CANCEL_ENABLE; attr->canceltype = PTHREAD_CANCEL_DEFERRED; + attr->cancel_pending = FALSE; attr->detachedstate = PTHREAD_CREATE_JOINABLE; memset(&(attr->sigmask), 0, sizeof(sigset_t)); /* Priority uses Win32 priority values. */ int priority = THREAD_PRIORITY_NORMAL; - attr->valid = 0; + attr->valid = _PTHREAD_ATTR_VALID; return 0; } @@ -120,7 +121,7 @@ pthread_attr_destroy(pthread_attr_t *attr) } /* Set the attribute object to a specific invalid value. */ - attr->valid = _PTHREAD_ATTR_INVALID; + attr->valid = 0; return 0; } @@ -134,7 +135,7 @@ pthread_attr_getdetachstate(const pthread_attr_t *attr, return EINVAL; } - *detachstate = attr->detached; + *detachstate = attr->detachedstate; return 0; } @@ -153,6 +154,6 @@ pthread_attr_setdetachstate(pthread_attr_t *attr, return EINVAL; } - attr->detached = detachstate; + attr->detachedstate = detachstate; return 0; } @@ -55,7 +55,8 @@ _pthread_exit(void * value, int return_code) be deleted by the last waiting pthread_join() after this thread has terminated. */ - if (us->detach == TRUE + if (pthread_attr_getdetachedstate(us, &detachstate) == 0 + && detachstate == PTHREAD_CREATE_DETACHED && us->join_count == 0) { _pthread_delete_thread_entry(us); diff --git a/implement.h b/implement.h index 5cc0de6..e830293 100644 --- a/implement.h +++ b/implement.h @@ -20,7 +20,7 @@ enum { _PTHREAD_HANDLER_POP_LIFO, _PTHREAD_HANDLER_POP_FIFO }; /* Special value to mark attribute objects as valid. */ -#define _PTHREAD_ATTR_INVALID 0xC0FFEE +#define _PTHREAD_ATTR_VALID 0xC0FFEE /* General description of a handler function on a stack. */ typedef struct _pthread_handler_node _pthread_handler_node_t; @@ -35,7 +35,6 @@ struct _pthread_handler_node { typedef struct { unsigned (*routine)(void *); void * arg; - jmpbuf env; } _pthread_call_t; /* Macro to return the address of the thread entry of the calling thread. */ @@ -109,8 +109,9 @@ _pthread_delete_thread_entry(_pthread_threads_thread_t * entry) if (entry->thread != NULL) { + pthread_attr_destroy(&(entry->attr)); entry->thread = NULL; - + if (_pthread_threads_count > 0) { _pthread_threads_count--; |