1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| | #include "pthread_impl.h"
#include <threads.h>
/* The behavior of cnd_destroy is undefined if cnd is still in
use. The choice for pthread_cond_destroy in that situation is to
wake up all users before destroying. I am not sure that we should
do it like that here, too. Alternatives would be:
- complain by using perror or equivalent
- assert that there is no waiter
- abort when there is a waiter
- do nothing
*/
void cnd_destroy(cnd_t *c)
{
int cnt;
c->_c_destroy = 1;
if (c->_c_waiters)
__wake(&c->_c_seq, -1, 0);
while ((cnt = c->_c_waiters))
__wait(&c->_c_waiters, 0, cnt, 0);
}
|