063dd51dc7
So far semaphore was used with possible values in range 0 to UINT32_MAX. Each write resulted in semaphore increment. As an example after two writes and single read eventfd counter was correctly zeroed, but semaphore counter was not. This means that poll() signalled at this stage POLLIN (semaphore counter was > 0), but it clearly should not (eventfd counter == 0). Blocking version of read() was also returning immediately, returning 0 as previous eventfd counter. Change read_sem to be a binary semaphore, which counter represents eventfd counter being zero (when semaphore counter == 0) or non-zero (when semaphore counter == 1). Try to take the semaphore in eventfd read() and decrement eventfd counter when semaphore was ready. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> |
||
---|---|---|
.. | ||
clock.c | ||
CMakeLists.txt | ||
eventfd.c | ||
fs.c | ||
Kconfig | ||
mqueue.c | ||
nanosleep.c | ||
pthread.c | ||
pthread_barrier.c | ||
pthread_common.c | ||
pthread_cond.c | ||
pthread_key.c | ||
pthread_mutex.c | ||
pthread_rwlock.c | ||
pthread_sched.c | ||
semaphore.c | ||
sleep.c | ||
timer.c |