util_semaphore_take() function
Take a semaphore. This routine takes @a sem.
Arguments
sem
Address of the semaphore.
timeout
Waiting period to take the semaphore (in milliseconds), or one of the special values K_NO_WAIT and K_FOREVER.
Return value
0 Semaphore taken. -EBUSY Returned without waiting. -EAGAIN Waiting period timed out.
Notes
Can be called by ISRs, but @a timeout must be set to K_NO_WAIT. When porting code from the nanokernel legacy API to the new API, be careful with the return value of this function. The return value is the reverse of the one of nano_sem_take family of APIs: 0 means success, and non-zero means failure, while the nano_sem_take family returns 1 for success and 0 for failure.