File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
libc-top-half/musl/src/thread Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,15 @@ _Noreturn void __pthread_exit(void *result)
182
182
* and then exits without touching the stack. */
183
183
__unmapself (self -> map_base , self -> map_size );
184
184
}
185
+ #else
186
+ if (state == DT_DETACHED && self -> map_base ) {
187
+ // __syscall(SYS_exit) would unlock the thread, list
188
+ // do it manually here
189
+ __tl_unlock ();
190
+ free (self -> map_base );
191
+ // Can't use `exit()` here, because it is too high level
192
+ for (;;) __wasi_proc_exit (0 );
193
+ }
185
194
#endif
186
195
187
196
/* Wake any joiner. */
@@ -197,7 +206,11 @@ _Noreturn void __pthread_exit(void *result)
197
206
#ifdef __wasilibc_unmodified_upstream
198
207
for (;;) __syscall (SYS_exit , 0 );
199
208
#else
200
- for (;;) exit (0 );
209
+ // __syscall(SYS_exit) would unlock the thread, list
210
+ // do it manually here
211
+ __tl_unlock ();
212
+ // Can't use `exit()` here, because it is too high level
213
+ for (;;) __wasi_proc_exit (0 );
201
214
#endif
202
215
}
203
216
You can’t perform that action at this time.
0 commit comments