zephyr/tests/kernel/workq/work
Andy Ross 6a1f721dda tests/kernel/workq: Fix semaphore counting
This test case will call k_sem_give() twice and expect both to be
received by k_sem_take(), yet the semaphore is initialized with a
maximum count of one!

The reason this worked was an undocumented misfeature of k_sem: if
k_sem_take() was called on a semaphore with a pended thread, it would
wake up that thread synchronously instead of incrementing the count.
So you could call it once to wake up the thread and again to queue the
count and not overflow.  The problem is that this is a priority bug (a
high priority runnable thread should have the chance to run and call
k_sem_take() before a low priority thread that got woken).

Zync corrects that, and so needs to have two slots if you want two
semaphore events.

Signed-off-by: Andy Ross <andyross@google.com>
2022-10-17 10:13:56 +02:00
..
src tests/kernel/workq: Fix semaphore counting 2022-10-17 10:13:56 +02:00
CMakeLists.txt
prj.conf
testcase.yaml