X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fexit%2Fexit.c;h=ae557c090d1793220764dc413267a4e8e29c5e35;hb=37bb3cce4598c19288628e675eaf1cda6e96958f;hp=bfdb3923fc98b6f515d8cab5cf90dcba7de1b4f6;hpb=e3cd6c5c265cd481db6e0c5b529855d99f0bda30;p=musl diff --git a/src/exit/exit.c b/src/exit/exit.c index bfdb3923..ae557c09 100644 --- a/src/exit/exit.c +++ b/src/exit/exit.c @@ -3,21 +3,24 @@ #include #include "libc.h" -/* __overflow.c and atexit.c override these */ -static int (*const dummy)() = 0; +static void dummy() +{ +} + +/* __towrite.c and atexit.c override these */ weak_alias(dummy, __funcs_on_exit); weak_alias(dummy, __fflush_on_exit); void exit(int code) { - static int lock; + static int lock[2]; /* If more than one thread calls exit, hang until _Exit ends it all */ - LOCK(&lock); + LOCK(lock); /* Only do atexit & stdio flush if they were actually used */ - if (__funcs_on_exit) __funcs_on_exit(); - if (__fflush_on_exit) __fflush_on_exit((void *)0); + __funcs_on_exit(); + __fflush_on_exit(); /* Destructor s**t is kept separate from atexit to avoid bloat */ if (libc.fini) libc.fini();