mutex_lock

Locks the specified mutex.

Library:LibC
Classification:UNIX International
Service:Synchronization

Syntax

  #include <synch.h>
   
  int   mutex_lock  (
     mutex_t   *mp );
  

Parameters

mp

(IN) Points to the mutex to lock.

Return Values

If successful, returns 0; otherwise returns a nonzero error code:

Decimal

Constant

Description

9

EINVAL

The mutex is not a valid mutex.

Remarks

The mutex_lock function acquires the specified mutually exclusive lock. If the lock being acquired is not free (is held by a different thread), the calling thread waits until the lock can be acquired. No assumptions can be made about the way the calling thread might wait for the lock to become free. The mutex is not guaranteed to be FIFO.

See Also