portability: cmsis: Fix possible race in osEventFlagsSet()

The CMSIS-RTOS specification says "The function returns the event flags
stored in the event control block".

In the original code, osEventFlagsSet() called k_event_post() and then
k_event_test(). It worked mostly fine if the thread has higher priority
than the waiter thread. In the opposite case, the event was not reported
to the user.

With the last changes, the waiter thread use k_event_wait_safe(). So, the
event is posted and consumed in an atomic way. So, the issue above happen
even if the waiter thread has a lower priority then the poster.

This patch fixes the both cases.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
1 file changed