SyncMutexUnlock(), SyncMutexUnlock_r()
Unlock a mutex synchronization object
Synopsis:
#include <sys/neutrino.h>
int SyncMutexUnlock( sync_t * sync );
int SyncMutexUnlock_r( sync_t * sync );
Arguments:
- sync
- A pointer to the synchronization object for the mutex that you want to unlock.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The SyncMutexUnlock() and SyncMutexUnlock_r() kernel calls unlock the mutex passed as sync. If there are threads blocked on the mutex, the owner member of sync is set to the thread ID of the thread with the highest priority that has been waiting the longest and it's made ready to run. If no threads are waiting, it's set to zero.
These functions are similar, except for the way they indicate errors. See the Returns section for details.
If the calling thread had its priority boosted while it owned the mutex, it returns to its normal priority.
Blocking states
These calls don't block.
Returns:
The only difference between these functions is the way they indicate errors:
- SyncMutexUnlock()
- If an error occurs, The function returns -1 and sets errno. Any other value returned indicates success.
- SyncMutexUnlock_r()
- Returns EOK on success. This function does NOT set errno. If an error occurs, the function returns any value listed in the Errors section.
Errors:
- EFAULT
- A fault occurred when the kernel tried to access the buffers provided.
- EINVAL
- The synchronization ID specified in sync doesn't exist. The calling thread doesn't own the mutex.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |