summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>1998-08-06 06:18:07 +0000
committerrpj <rpj>1998-08-06 06:18:07 +0000
commitad2fc723a301cf4e6cda882d93199548d525c879 (patch)
tree2e4d80dcc9b66d99f1b16e8b8b83740087739807
parent20ebb838b7d10a0f315ae399439f71dd7bcba764 (diff)
Thu Aug 6 15:19:22 1998 Ross Johnson <rpj@swan.canberra.edu.au>
* sync.c (pthread_join): Remove target_thread_mutex and it's initialisation. Rename getdetachedstate to getdetachstate. Remove unused variable "exitcode". (pthread_detach): Remove target_thread_mutex and it's initialisation. Rename getdetachedstate to getdetachstate. Rename setdetachedstate to setdetachstate.
-rw-r--r--ChangeLog7
-rw-r--r--sync.c19
2 files changed, 12 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 52fa0d1..cc2f15d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
Thu Aug 6 15:19:22 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+ * sync.c (pthread_join): Remove target_thread_mutex and it's
+ initialisation. Rename getdetachedstate to getdetachstate.
+ Remove unused variable "exitcode".
+ (pthread_detach): Remove target_thread_mutex and it's
+ initialisation. Rename getdetachedstate to getdetachstate.
+ Rename setdetachedstate to setdetachstate.
+
* signal.c (pthread_sigmask): Rename SIG_SET to SIG_SETMASK.
Cast "set" to (long *) in assignment to passify compiler warning.
Add address-of operator & to thread->attr.sigmask in memcpy() call
diff --git a/sync.c b/sync.c
index 69a10f6..87d5a30 100644
--- a/sync.c
+++ b/sync.c
@@ -55,7 +55,6 @@
int
pthread_join(pthread_t thread, void ** valueptr)
{
- LPDWORD exitcode;
int detachstate;
/* First check if we are trying to join to ourselves. */
@@ -66,18 +65,15 @@ pthread_join(pthread_t thread, void ** valueptr)
if (thread != NULL)
{
- pthread_mutex_t * target_thread_mutex;
int ret;
- target_thread_mutex = _PTHREAD_THREAD_MUTEX(thread);
-
/* CRITICAL SECTION */
pthread_mutex_lock(&_pthread_table_mutex);
/* If the thread is in DETACHED state, then join will return
immediately. */
- if (pthread_attr_getdetachedstate(&(thread->attr), &detachstate) != 0
+ if (pthread_attr_getdetachstate(&(thread->attr), &detachstate) != 0
|| detachstate == PTHREAD_CREATE_DETACHED)
{
return EINVAL;
@@ -120,14 +116,14 @@ pthread_join(pthread_t thread, void ** valueptr)
pointed to by thread->joinvalueptr has been freed or
otherwise no longer valid. */
- if (pthread_attr_getdetachedstate(&(thread->attr), &detachstate) != 0
+ if (pthread_attr_getdetachstate(&(thread->attr), &detachstate) != 0
|| detachstate == PTHREAD_CREATE_DETACHED)
{
ret = EDEADLK;
}
else
{
- *value_ptr = thread->joinvalueptr;
+ *valueptr = thread->joinvalueptr;
ret = 0;
}
@@ -155,7 +151,6 @@ pthread_detach(pthread_t thread)
{
int detachstate;
int ret;
- pthread_mutex_t * target_thread_mutex;
/* CRITICAL SECTION */
pthread_mutex_lock(&_pthread_table_mutex);
@@ -166,22 +161,18 @@ pthread_detach(pthread_t thread)
}
else
{
-
- target_thread_mutex = _PTHREAD_THREAD_MUTEX(thread);
-
/* Check that we can detach this thread. */
- if (pthread_attr_getdetachedstate(&(thread->attr), &detachstate) != 0
+ if (pthread_attr_getdetachstate(&(thread->attr), &detachstate) != 0
|| detachstate == PTHREAD_CREATE_DETACHED)
{
ret = EINVAL;
}
else
{
-
/* This is all we do here - the rest is done either when the
thread exits or when pthread_join() exits. Once this is
set it will never be unset. */
- pthread_attr_setdetachedstate(&(thread->attr),
+ pthread_attr_setdetachstate(&(thread->attr),
PTHREAD_CREATE_DETACHED);
ret = 0;