about summary refs log tree commit diff
path: root/src/thread
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-08-02 21:15:20 -0400
committerRich Felker <dalias@aerifal.cx>2011-08-02 21:15:20 -0400
commitbdd893377fe65519fae90948cd8f3c635757eaba (patch)
treed75f7e3fd385c048cdc6084a6cb935f355b30512 /src/thread
parentec381af90208a5675183202cf05078eac208edfb (diff)
downloadmusl-bdd893377fe65519fae90948cd8f3c635757eaba.tar.gz
musl-bdd893377fe65519fae90948cd8f3c635757eaba.tar.xz
musl-bdd893377fe65519fae90948cd8f3c635757eaba.zip
fix sem_timedwait bug introduced in timedwait unification
this dec used to be performed by the cancellation handler, which was
called when popped.
Diffstat (limited to 'src/thread')
-rw-r--r--src/thread/sem_timedwait.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/thread/sem_timedwait.c b/src/thread/sem_timedwait.c
index 4e12389c..64b4342c 100644
--- a/src/thread/sem_timedwait.c
+++ b/src/thread/sem_timedwait.c
@@ -13,6 +13,7 @@ int sem_timedwait(sem_t *sem, const struct timespec *at)
 		a_inc(sem->__val+1);
 		a_cas(sem->__val, 0, -1);
 		r = __timedwait(sem->__val, -1, CLOCK_REALTIME, at, cleanup, sem->__val+1, 0);
+		a_dec(sem->__val+1);
 		if (r) {
 			errno = r;
 			return -1;