X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fexit%2Fexit.c;h=fc2914844959eac78a3f76dccb302ef0d3d8fe25;hp=1ff19dbeeb9b41ba3f9548f05a159ab63cdcacf1;hb=47c2a22fd6adcaf3f27b093df49bd97e3fdc16e7;hpb=f753049a50132a23849ef89a8af5ff86ad595c25 diff --git a/src/exit/exit.c b/src/exit/exit.c index 1ff19dbe..fc291484 100644 --- a/src/exit/exit.c +++ b/src/exit/exit.c @@ -2,6 +2,8 @@ #include #include #include "libc.h" +#include "atomic.h" +#include "syscall.h" static void dummy() { @@ -16,7 +18,7 @@ void exit(int code) static int lock; /* If more than one thread calls exit, hang until _Exit ends it all */ - LOCK(&lock); + while (a_swap(&lock, 1)) __syscall(SYS_pause); /* Only do atexit & stdio flush if they were actually used */ __funcs_on_exit();