[Previous] [Contents] [Index] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

SyncMutexEvent(), SyncMutexEvent_r()

Attach an event to a mutex

Synopsis:

#include <sys/neutrino.h>

int SyncMutexEvent( sync_t * sync,
                    struct sigevent * event );

int SyncMutexEvent_r( sync_t * sync,
                      struct sigevent * event );

Arguments:

sync
A pointer to the synchronization object for the mutex that you want to attach an event to.
event
A pointer to the sigevent structure that describes the event that you want to attach.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

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.

SyncMutexEvent() and SyncMutexEvent_r() are similar, except for the way they indicate errors. See the Returns section for details.

Returns:

The only difference between these functions is the way they indicate errors:

SyncMutexEvent()
If an error occurs, the function returns -1 and sets errno. Any other value returned indicates success.
SyncMutexEvent_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:

EAGAIN
All kernel synchronization event objects are in use.
EFAULT
A fault occurred when the kernel tried to access sync.
EINVAL
The synchronization object pointed to by sync doesn't exist.

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

sigevent, SyncCondvarSignal(), SyncCondvarWait(), SyncDestroy(), SyncMutexLock(), SyncMutexRevive(), SyncMutexUnlock()


[Previous] [Contents] [Index] [Next]