VMS Help  —  POSIX Threads, PTHREAD routines, pthread_mutex_trylock, Description
    This routine attempts to lock the mutex specified in the mutex
    argument. When a thread calls this routine, an attempt is made to
    immediately lock the mutex. If the mutex is successfully locked,
    this routine returns zero (0) and the calling thread becomes the
    mutex's current owner. If the specified mutex is locked when a
    thread calls this routine, the calling thread does not wait for
    the mutex to become available.

    The behavior of this routine is as follows:

    o  For a normal, default, or errorcheck mutex: if the mutex
       is locked by any thread (including the calling thread) when
       this routine is called, this routine returns [EBUSY] and the
       calling thread does not wait to acquire the lock.

    o  For a normal or errorcheck mutex: if the mutex is not owned,
       this routine returns zero (0) and the mutex becomes locked by
       the calling thread.

    o  For a recursive mutex: if the mutex is owned by the current
       thread, this routine returns zero (0) and the mutex lock count
       is incremented. (To unlock a recursive mutex, each call to
       pthread_mutex_trylock() must be matched by a call to pthread_
       mutex_unlock().)

    Use the pthread_mutexattr_settype() routine to set the mutex type
    attribute (normal, default, recursive, or errorcheck).
Close Help