Attach an event to a mutex
#include <sys/neutrino.h> int SyncMutexEvent( sync_t * sync, struct sigevent * event ); int SyncMutexEvent_r( sync_t * sync, struct sigevent * event );
- A pointer to the synchronization object for the mutex that you want to attach an event to.
- A pointer to the sigevent structure that describes the event that you want to attach, or NULL if you want to detach the currently registered event.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The SyncMutexEvent() is a kernel call that attaches a specified event to a mutex pointed to by sync. You use SyncMutexRevive() to revive a DEAD mutex. Normally, a mutex will be placed in the DEAD state when the memory that was used to lock the mutex gets unmapped. One of the ways this may happen is when a process dies while holding the mutex in a shared memory.
If you call SyncMutexEvent() with a NULL event, the function deletes any existing event registration.
SyncMutexEvent() and SyncMutexEvent_r() are similar, except for the way they indicate errors. See the Returns section for details.
The only difference between these functions is the way they indicate errors:
- If an error occurs, the function returns -1 and sets errno . Any other value returned indicates success.
- Returns EOK on success. This function does NOT set errno. If an error occurs, the function returns any value listed in the Errors section.
- All kernel synchronization event objects are in use.
- A fault occurred when the kernel tried to access sync.
- The synchronization object pointed to by sync doesn't exist.
- The calling process doesn't have the required permission; see procmgr_ability() .