-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
Hi, developers, thank you for your checking! Should the lock be released before destroying it(Line 158 and 164)? According to this, it says It shall be safe to destroy an initialized mutex that is unlocked.
Lines 150 to 165 in 1df580c
| pthread_attr_t attr; | |
| pthread_attr_init(&attr); | |
| pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); | |
| pthread_mutex_init(&p.lock,NULL); | |
| pthread_mutex_lock(&p.lock); | |
| // force the use of a the GC method to capture created threads | |
| // this function should be defined in gc/gc.h | |
| if( GC_pthread_create((pthread_t*)handle,&attr,&ThreadMain,&p) != 0 ) { | |
| pthread_attr_destroy(&attr); | |
| pthread_mutex_destroy(&p.lock); | |
| return 0; | |
| } | |
| pthread_mutex_lock(&p.lock); | |
| pthread_attr_destroy(&attr); | |
| pthread_mutex_destroy(&p.lock); | |
| return 1; |
Metadata
Metadata
Assignees
Labels
No labels