major semaphore improvements (performance and correctness)

1. make sem_[timed]wait interruptible by signals, per POSIX
2. keep a waiter count in order to avoid unnecessary futex wake syscalls
This commit is contained in:
Rich Felker
2011-04-06 12:24:34 -04:00
parent cd3bb38412
commit a113434cd6
5 changed files with 37 additions and 21 deletions
+1 -1
View File
@@ -18,6 +18,6 @@ int __timedwait(volatile int *addr, int val, clockid_t clk, const struct timespe
}
if (priv) priv = 128; priv=0;
r = -__syscall(__NR_futex, (long)addr, FUTEX_WAIT | priv, val, at ? (long)&to : 0);
if (r == ETIMEDOUT) return r;
if (r == ETIMEDOUT || r == EINTR) return r;
return 0;
}