From 1ddc9bd2a0e5f9f4835e39c05df0850cb9aa44bf Mon Sep 17 00:00:00 2001 From: moteus Date: Thu, 26 Dec 2013 12:33:05 +0400 Subject: Fix. compile pthread version. --- src/llthread.c | 10 ++++++---- 1 file 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() { if(!this) return NULL; this->flags = TSTATE_NONE; +#ifndef USE_PTHREAD this->thread = INVALID_THREAD; +#endif this->child = llthread_child_new(); if(!this->child){ FREE_STRUCT(this); @@ -443,14 +445,14 @@ static int llthread_start(llthread_t *this, int start_detached) { #ifndef USE_PTHREAD this->thread = (HANDLE)_beginthreadex(NULL, 0, llthread_child_thread_run, child, 0, NULL); + if(INVALID_THREAD == this->thread){ + rc = -1 + } #else rc = pthread_create(&(this->thread), NULL, llthread_child_thread_run, child); - if(rc == 0){ - this->thread = INVALID_THREAD - } #endif - if(this->thread != INVALID_THREAD) { + if(rc == 0) { FLAG_SET(this, TSTATE_STARTED); if(start_detached) { FLAG_SET(this, TSTATE_DETACHED); -- cgit v1.2.3-55-g6feb