mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 07:23:39 +00:00
internal/task: prevent semaphore resource leak for threads scheduler
This commit is contained in:
committed by
Damian Gryski
parent
1c27ecb66f
commit
e356daa229
@@ -131,8 +131,10 @@ int tinygo_task_start(uintptr_t fn, void *args, void *task, pthread_t *thread, u
|
|||||||
// Wait until the thread has been created and read all state_pass variables.
|
// Wait until the thread has been created and read all state_pass variables.
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
dispatch_semaphore_wait(state.startlock, DISPATCH_TIME_FOREVER);
|
dispatch_semaphore_wait(state.startlock, DISPATCH_TIME_FOREVER);
|
||||||
|
dispatch_release(state.startlock);
|
||||||
#else
|
#else
|
||||||
sem_wait(&state.startlock);
|
sem_wait(&state.startlock);
|
||||||
|
sem_destroy(&state.startlock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user