condition variable signal/bcast need not wake unless there are waiters
This commit is contained in:
parent
cdfb725ca3
commit
1407785824
2 changed files with 4 additions and 4 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
int pthread_cond_broadcast(pthread_cond_t *c)
|
int pthread_cond_broadcast(pthread_cond_t *c)
|
||||||
{
|
{
|
||||||
c->_c_block = 0;
|
if (a_swap(&c->_c_block, 0))
|
||||||
__wake(&c->_c_block, -1, 0);
|
__wake(&c->_c_block, -1, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
int pthread_cond_signal(pthread_cond_t *c)
|
int pthread_cond_signal(pthread_cond_t *c)
|
||||||
{
|
{
|
||||||
c->_c_block = 0;
|
if (a_swap(&c->_c_block, 0));
|
||||||
__wake(&c->_c_block, 1, 0);
|
__wake(&c->_c_block, 1, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue