WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit e356daa

Browse files
committed
internal/task: prevent semaphore resource leak for threads scheduler
1 parent 1c27ecb commit e356daa

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/internal/task/task_threads.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ int tinygo_task_start(uintptr_t fn, void *args, void *task, pthread_t *thread, u
131131
// Wait until the thread has been created and read all state_pass variables.
132132
#if __APPLE__
133133
dispatch_semaphore_wait(state.startlock, DISPATCH_TIME_FOREVER);
134+
dispatch_release(state.startlock);
134135
#else
135136
sem_wait(&state.startlock);
137+
sem_destroy(&state.startlock);
136138
#endif
137139

138140
return result;

0 commit comments

Comments
 (0)