Fix sem_post() behaviour to wake up multiple waiting threads.

This commit is contained in:
David 'Digit' Turner 2010-02-12 12:50:32 -08:00
parent 294dd0b86b
commit 4f920f685b
2 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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: