summaryrefslogtreecommitdiff
path: root/create.c
diff options
context:
space:
mode:
authorrpj <rpj>1998-07-25 14:26:49 +0000
committerrpj <rpj>1998-07-25 14:26:49 +0000
commitee95385721e0dbd4ba637e78b30101f1c9d24e75 (patch)
tree679e77e5555d60e74d3b748be295a67c3b13e9d6 /create.c
parent74c0f91a6baa41a437cf2b45a209d5041820c131 (diff)
Sun Jul 26 00:09:59 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* private.c (_pthread_delete_thread_entry): Mutex locks removed. Mutexes must be applied at the caller level. (_pthread_new_thread_entry): Ditto. (_pthread_new_thread_entry): Init cancelstate, canceltype, and cancel_pending to default values. (_pthread_new_thread_entry): Rename "this" to "new". (_pthread_find_thread_entry): Rename "this" to "entry". (_pthread_delete_thread_entry): Rename "thread_entry" to "entry". * create.c (_pthread_start_call): Mutexes changed to _pthread_count_mutex. All access to the threads table entries is under the one mutex. Otherwise chaos reigns. Sat Jul 25 23:16:51 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * implement.h (_pthread_threads_thread): Move cancelstate and canceltype members out of pthread_attr_t into here.
Diffstat (limited to 'create.c')
-rw-r--r--create.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/create.c b/create.c
index 2a94baf..8cc5a57 100644
--- a/create.c
+++ b/create.c
@@ -20,7 +20,6 @@ _pthread_start_call(void * us_arg)
this threads private stack so we're safe to leave data in them
until we leave. */
_pthread_threads_thread__t * us;
- pthread_mutex_t * us_thread_mutex;
_pthread_call_t * call;
unsigned (*func)(void *);
void * arg;
@@ -39,8 +38,6 @@ _pthread_start_call(void * us_arg)
func = us->call.routine;
arg = us->call.arg;
- us_thread_mutex = _PTHREAD_THREAD_MUTEX(us);
-
/* FIXME: Should we be using sigsetjmp() here instead. */
from = setjmp(us->call.env);
@@ -55,7 +52,7 @@ _pthread_start_call(void * us_arg)
was called and there are no waiting joins. */
/* CRITICAL SECTION */
- pthread_mutex_lock(us_thread_mutex);
+ pthread_mutex_lock(&_pthread_count_mutex);
if (us->detach == TRUE
&& us->join_count == 0)
@@ -63,7 +60,7 @@ _pthread_start_call(void * us_arg)
_pthread_delete_thread_entry(us);
}
- pthread_mutex_lock(us_thread_mutex);
+ pthread_mutex_lock(&_pthread_count_mutex);
/* END CRITICAL SECTION */
}
else
@@ -76,7 +73,7 @@ _pthread_start_call(void * us_arg)
was called and there are no waiting joins. */
/* CRITICAL SECTION */
- pthread_mutex_lock(us_thread_mutex);
+ pthread_mutex_lock(&_pthread_count_mutex);
if (us->detach == TRUE
&& us->join_count == 0)
@@ -84,7 +81,7 @@ _pthread_start_call(void * us_arg)
_pthread_delete_thread_entry(us);
}
- pthread_mutex_lock(us_thread_mutex);
+ pthread_mutex_lock(&_pthread_count_mutex);
/* END CRITICAL SECTION */
ret = 0;
@@ -130,10 +127,10 @@ pthread_create(pthread_t *thread,
#if HAVE_SIGSET_T
memcpy(&(attr_copy->sigmask), &(attr->sigmask), sizeof(sigset_t));
#endif /* HAVE_SIGSET_T */
-
- this->detach = (attr->detachedstate == PTHREAD_CREATE_DETACHED);
}
+ this->detach = (attr->detachedstate == PTHREAD_CREATE_DETACHED);
+
/* Start running, not suspended. */
flags = 0;