Fix sem_post() behaviour to wake up multiple waiting threads.
This commit is contained in:
parent
294dd0b86b
commit
4f920f685b
|
@ -180,7 +180,7 @@ int sem_post(sem_t *sem)
|
|||
if (sem == NULL)
|
||||
return EINVAL;
|
||||
|
||||
if (__atomic_inc((volatile int*)&sem->count) == 0)
|
||||
if (__atomic_inc((volatile int*)&sem->count) >= 0)
|
||||
__futex_wake(&sem->count, 1);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -55,6 +55,9 @@ Differences between current and Android 2.1:
|
|||
- fix sem_trywait() to return -1 and set errno to EAGAIN, instead of
|
||||
returning EAGAIN directly.
|
||||
|
||||
- fix sem_post() to wake up multiple threads when called rapidly in
|
||||
succession.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Differences between Android 2.1 and 2.0.1:
|
||||
|
||||
|
|
Loading…
Reference in New Issue