diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/llthread.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/llthread.c b/src/llthread.c index b3b2ed6..6cb437b 100644 --- a/src/llthread.c +++ b/src/llthread.c | |||
@@ -398,7 +398,9 @@ static llthread_t *llthread_new() { | |||
398 | if(!this) return NULL; | 398 | if(!this) return NULL; |
399 | 399 | ||
400 | this->flags = TSTATE_NONE; | 400 | this->flags = TSTATE_NONE; |
401 | #ifndef USE_PTHREAD | ||
401 | this->thread = INVALID_THREAD; | 402 | this->thread = INVALID_THREAD; |
403 | #endif | ||
402 | this->child = llthread_child_new(); | 404 | this->child = llthread_child_new(); |
403 | if(!this->child){ | 405 | if(!this->child){ |
404 | FREE_STRUCT(this); | 406 | FREE_STRUCT(this); |
@@ -443,14 +445,14 @@ static int llthread_start(llthread_t *this, int start_detached) { | |||
443 | 445 | ||
444 | #ifndef USE_PTHREAD | 446 | #ifndef USE_PTHREAD |
445 | this->thread = (HANDLE)_beginthreadex(NULL, 0, llthread_child_thread_run, child, 0, NULL); | 447 | this->thread = (HANDLE)_beginthreadex(NULL, 0, llthread_child_thread_run, child, 0, NULL); |
448 | if(INVALID_THREAD == this->thread){ | ||
449 | rc = -1 | ||
450 | } | ||
446 | #else | 451 | #else |
447 | rc = pthread_create(&(this->thread), NULL, llthread_child_thread_run, child); | 452 | rc = pthread_create(&(this->thread), NULL, llthread_child_thread_run, child); |
448 | if(rc == 0){ | ||
449 | this->thread = INVALID_THREAD | ||
450 | } | ||
451 | #endif | 453 | #endif |
452 | 454 | ||
453 | if(this->thread != INVALID_THREAD) { | 455 | if(rc == 0) { |
454 | FLAG_SET(this, TSTATE_STARTED); | 456 | FLAG_SET(this, TSTATE_STARTED); |
455 | if(start_detached) { | 457 | if(start_detached) { |
456 | FLAG_SET(this, TSTATE_DETACHED); | 458 | FLAG_SET(this, TSTATE_DETACHED); |