aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/llthread.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/llthread.c b/src/llthread.c
index 5bcd821..7404bd7 100644
--- a/src/llthread.c
+++ b/src/llthread.c
@@ -45,6 +45,7 @@
45# define INFINITE_JOIN_TIMEOUT INFINITE 45# define INFINITE_JOIN_TIMEOUT INFINITE
46# define JOIN_OK 0 46# define JOIN_OK 0
47# define JOIN_ETIMEDOUT 1 47# define JOIN_ETIMEDOUT 1
48# define JOIN_FAIL 2
48typedef DWORD join_timeout_t; 49typedef DWORD join_timeout_t;
49typedef HANDLE os_thread_t; 50typedef HANDLE os_thread_t;
50#else 51#else
@@ -540,22 +541,22 @@ static int llthread_join(llthread_t *this, join_timeout_t timeout) {
540 CloseHandle( this->thread ); 541 CloseHandle( this->thread );
541 this->thread = INVALID_THREAD; 542 this->thread = INVALID_THREAD;
542 FLAG_SET(this, TSTATE_JOINED); 543 FLAG_SET(this, TSTATE_JOINED);
543 return 0; 544 return JOIN_OK;
544 } 545 }
545 else if( ret == WAIT_TIMEOUT ){ 546 else if( ret == WAIT_TIMEOUT ){
546 return 1; 547 return JOIN_ETIMEDOUT;
547 } 548 }
548 return 2; 549 return JOIN_FAIL;
549#else 550#else
550 int rc; 551 int rc;
551 if(timeout == 0){ 552 if(timeout == 0){
552 rc = pthread_kill(this->thread, 0); 553 rc = pthread_kill(this->thread, 0);
553 if(rc == 0){ /* still alive */ 554 if(rc == 0){ /* still alive */
554 rc = ETIMEDOUT; 555 rc = JOIN_ETIMEDOUT;
555 } 556 }
556 if(rc == ESRCH){ /*thread dead*/ 557 if(rc == ESRCH){ /*thread dead*/
557 FLAG_SET(this, TSTATE_JOINED); 558 FLAG_SET(this, TSTATE_JOINED);
558 rc = 0; 559 rc = JOIN_OK;
559 } 560 }
560 return rc; 561 return rc;
561 } 562 }
@@ -566,6 +567,7 @@ static int llthread_join(llthread_t *this, join_timeout_t timeout) {
566 rc = pthread_join(this->thread, NULL); 567 rc = pthread_join(this->thread, NULL);
567 if((rc == 0) || (rc == ESRCH)) { 568 if((rc == 0) || (rc == ESRCH)) {
568 FLAG_SET(this, TSTATE_JOINED); 569 FLAG_SET(this, TSTATE_JOINED);
570 rc = JOIN_OK;
569 } 571 }
570 return rc; 572 return rc;
571#endif 573#endif