diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/llthread.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/llthread.c b/src/llthread.c index 354cdee..0c4a107 100644 --- a/src/llthread.c +++ b/src/llthread.c | |||
| @@ -294,16 +294,16 @@ static void llthread_destroy(llthread_t *this) { | |||
| 294 | break; | 294 | break; |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | /* ATACHED */ | 297 | /* ATTACHED */ |
| 298 | if(!IS(this, JOINED)){ | 298 | if(!IS(this, JOINED)){ |
| 299 | llthread_join(this, INFINITE_JOIN_TIMEOUT); | 299 | llthread_join(this, INFINITE_JOIN_TIMEOUT); |
| 300 | if(!IS(this, JOINED)){ | 300 | if(!IS(this, JOINED)){ |
| 301 | /* @todo use current lua state to logging */ | 301 | /* @todo use current lua state to logging */ |
| 302 | /* | 302 | /* |
| 303 | * char buf[ERROR_LEN]; | 303 | * char buf[ERROR_LEN]; |
| 304 | * strerror_r(errno, buf, ERROR_LEN); | 304 | * strerror_r(errno, buf, ERROR_LEN); |
| 305 | * llthread_log(L, "Error can not join thread on gc: ", buf); | 305 | * llthread_log(L, "Error can not join thread on gc: ", buf); |
| 306 | */ | 306 | */ |
| 307 | } | 307 | } |
| 308 | } | 308 | } |
| 309 | if(IS(this, JOINABLE)){ | 309 | if(IS(this, JOINABLE)){ |
| @@ -329,11 +329,12 @@ static int llthread_detach(llthread_t *this){ | |||
| 329 | assert(IS(this, STARTED)); | 329 | assert(IS(this, STARTED)); |
| 330 | assert(this->child != NULL); | 330 | assert(this->child != NULL); |
| 331 | 331 | ||
| 332 | this->child = NULL; | ||
| 333 | |||
| 332 | /*we can not detach joined thread*/ | 334 | /*we can not detach joined thread*/ |
| 333 | if(IS(this, JOINED)) | 335 | if(IS(this, JOINED)) |
| 334 | return 0; | 336 | return 0; |
| 335 | 337 | ||
| 336 | this->child = NULL; | ||
| 337 | #ifdef USE_PTHREAD | 338 | #ifdef USE_PTHREAD |
| 338 | rc = pthread_detach(this->thread); | 339 | rc = pthread_detach(this->thread); |
| 339 | #else | 340 | #else |
