mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +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.
|
||||
#if __APPLE__
|
||||
dispatch_semaphore_wait(state.startlock, DISPATCH_TIME_FOREVER);
|
||||
dispatch_release(state.startlock);
|
||||
#else
|
||||
sem_wait(&state.startlock);
|
||||
sem_destroy(&state.startlock);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user