X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fthread%2Fsynccall.c;h=2cd25e4bb2b84315ca4adb9c562d4592eebcb55a;hp=91ac5eb77322da7393f778da29d35fb3c2def15d;hb=407d933052c310ebc5541dae2ecd8c4bd8f55fb9;hpb=b1a7102d832220066e7352f40e5744da932f5a28 diff --git a/src/thread/synccall.c b/src/thread/synccall.c index 91ac5eb7..2cd25e4b 100644 --- a/src/thread/synccall.c +++ b/src/thread/synccall.c @@ -4,7 +4,7 @@ static struct chain { struct chain *next; sem_t sem, sem2; -} *head; +} *head, *cur; static void (*callback)(void *), *context; static int chainlen; @@ -47,11 +47,19 @@ static void handler(int sig, siginfo_t *si, void *ctx) errno = old_errno; } +void __synccall_wait() +{ + struct chain *ch = cur; + sem_post(&ch->sem2); + while (sem_wait(&ch->sem)); + sem_post(&ch->sem); +} + void __synccall(void (*func)(void *), void *ctx) { pthread_t self; struct sigaction sa; - struct chain *cur, *next; + struct chain *next; uint64_t oldmask; if (!libc.threads_minus_1) {