aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoteus <mimir@newmail.ru>2013-12-26 12:33:05 +0400
committermoteus <mimir@newmail.ru>2013-12-26 12:33:05 +0400
commit1ddc9bd2a0e5f9f4835e39c05df0850cb9aa44bf (patch)
treefe8e21553b713e510f6bd38438cbe68b3eeaf5fc
parentb812e80d753b6e37fbf59fcc03e0056cb5c53b27 (diff)
downloadlua-llthreads2-1ddc9bd2a0e5f9f4835e39c05df0850cb9aa44bf.tar.gz
lua-llthreads2-1ddc9bd2a0e5f9f4835e39c05df0850cb9aa44bf.tar.bz2
lua-llthreads2-1ddc9bd2a0e5f9f4835e39c05df0850cb9aa44bf.zip
Fix. compile pthread version.
-rw-r--r--src/llthread.c10
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);