diff options
| author | bje <bje> | 1998-07-23 15:51:20 +0000 | 
|---|---|---|
| committer | bje <bje> | 1998-07-23 15:51:20 +0000 | 
| commit | ad204c1d96ff23ab2421b8890d984fe5d78f690b (patch) | |
| tree | f11212e7adc1be40e1ff0992dcef91d105dfc673 | |
| parent | 77116f1ab96c37848c06f23188fea4009be92ae3 (diff) | |
1998-07-24  Ben Elliston  <bje@cygnus.com>
	* sync.c (pthread_join): Return if the target thread is detached.
| -rw-r--r-- | sync.c | 14 | 
1 files changed, 14 insertions, 0 deletions
| @@ -12,6 +12,8 @@ int  pthread_join(pthread_t thread, void ** valueptr)  {    LPDWORD exitcode; +  _pthread_threads_thread_t * target; +    pthread_t us = pthread_self();    /* First check if we are trying to join to ourselves. */ @@ -20,6 +22,18 @@ pthread_join(pthread_t thread, void ** valueptr)        return EDEADLK;      } +  /* If the thread is detached, then join will return immediately. */ + +  target = _pthread_find_thread_entry(thread); +  if (target < 0) +    { +      return EINVAL; +    } +  else if (target->detached == PTHREAD_CREATE_DETACHED) +    { +      return ESRCH; +    } +    /* Wait on the kernel thread object. */    switch (WaitForSingleObject(thread, INFINITE))      { | 
