mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 23:08:31 +00:00
Make detached threads work better
This change adds a double linked list of threads, so that pthread_exit() will know when it should call exit() from an orphaned child. This change also improves ftrace and strace logging.
This commit is contained in:
parent
b74d8c1acd
commit
cee6871710
37 changed files with 638 additions and 314 deletions
|
@ -23,9 +23,12 @@
|
|||
void _pthread_ungarbage(void) {
|
||||
int i;
|
||||
struct Garbages *g;
|
||||
if ((g = __get_tls()->tib_garbages)) {
|
||||
for (i = g->i; i--;) {
|
||||
((void (*)(intptr_t))g->p[i].fn)(g->p[i].arg);
|
||||
struct CosmoTib *tib;
|
||||
tib = __get_tls();
|
||||
while ((g = tib->tib_garbages)) {
|
||||
tib->tib_garbages = 0;
|
||||
while (g->i--) {
|
||||
((void (*)(intptr_t))g->p[g->i].fn)(g->p[g->i].arg);
|
||||
}
|
||||
free(g->p);
|
||||
free(g);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue