#define _c_lock __u.__i[5]
#define _c_lockwait __u.__i[6]
#define _c_waiters2 __u.__i[7]
+#define _c_destroy __u.__i[8]
#define _rw_lock __u.__i[0]
#define _rw_waiters __u.__i[1]
#define _b_lock __u.__i[0]
int pthread_cond_destroy(pthread_cond_t *c)
{
+ int priv = c->_c_mutex != (void *)-1;
+ int cnt;
+ c->_c_destroy = 1;
+ if (c->_c_waiters)
+ __wake(&c->_c_seq, -1, priv);
+ while ((cnt = c->_c_waiters))
+ __wait(&c->_c_waiters, 0, cnt, priv);
return 0;
}
if (c->_c_mutex == (void *)-1) {
a_dec(&c->_c_waiters);
+ if (c->_c_destroy) __wake(&c->_c_waiters, 1, 0);
return;
}
a_store(&c->_c_lock, 0);
if (c->_c_lockwait) __wake(&c->_c_lock, 1, 1);
+
+ a_dec(&c->_c_waiters);
+ if (c->_c_destroy) __wake(&c->_c_waiters, 1, 1);
}
static void cleanup(void *p)