forksafe_mutex_trylock()

Attempt to lock a forksafe mutex

Synopsis:

#include <forksafe_mutex.h>

int forksafe_mutex_trylock( forksafe_mutex_t* mutex );

Arguments:

mutex
A pointer to the forksafe_mutex_t object that you want to try to lock.

Library:

libc

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

Description:

The forksafe_mutex_trylock() function attempts to lock the forksafe mutex mutex, but doesn't block the calling thread if the mutex is already locked.

For more information about forksafe mutexes, see "Using fork() in a multithreaded process" in the "Processes and Threads" chapter of Getting Started with QNX Neutrino.

Returns:

EOK
Success.
EAGAIN
Insufficient resources available to lock the mutex.
EBUSY
The mutex was already locked.
EINVAL
The mutex is invalid, or it has died (see SyncMutexEvent()).

Classification:

QNX Neutrino

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