1--- pth_sync.c.old	2005-11-13 16:59:45.000000000 +0100
2+++ pth_sync.c	2005-11-13 17:00:36.000000000 +0100
3@@ -240,12 +240,13 @@
4     pth_mutex_t *mutex = (pth_mutex_t *)(((void **)_cleanvec)[0]);
5     pth_cond_t  *cond  = (pth_cond_t  *)(((void **)_cleanvec)[1]);
6
7+    /* fix number of waiters */
8+    cond->cn_waiters--;
9+
10     /* re-acquire mutex when pth_cond_await() is cancelled
11        in order to restore the condition variable semantics */
12     pth_mutex_acquire(mutex, FALSE, NULL);
13
14-    /* fix number of waiters */
15-    cond->cn_waiters--;
16     return;
17 }
18
19@@ -284,6 +285,10 @@
20     cleanvec[1] = cond;
21     pth_cleanup_push(pth_cond_cleanup_handler, cleanvec);
22     pth_wait(ev);
23+
24+    /* remove us from the number of waiters */
25+    cond->cn_waiters--;
26+
27     pth_cleanup_pop(FALSE);
28     if (ev_extra != NULL)
29         pth_event_isolate(ev);
30@@ -291,9 +296,6 @@
31     /* reacquire mutex */
32     pth_mutex_acquire(mutex, FALSE, NULL);
33
34-    /* remove us from the number of waiters */
35-    cond->cn_waiters--;
36-
37     /* release mutex (caller had to acquire it first) */
38     return TRUE;
39 }
40