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