lock a mutex
int _lwp_mutex_lock(lwp_mutex_t *mutex);
pointer to mutex to be locked
_lwp_mutex_lock is used to apply the mutual
exclusion lock on a mutex on behalf of the calling lightweight process (LWP).
The parameter mutex points to the mutex on which
the lock is to be applied.
The mutex must previously have been initialized.
A lwp_mutex_t object filled with zeros (for example,
by static initialization) is a valid unlocked setting.
If the mutex is already locked upon entry,
the operation suspends the calling LWP until the mutex becomes
From the point of view of the caller, _lwp_mutex_lock is atomic:
even if interrupted by a signal or a fork operation,
_lwp_mutex_lock will not return until it holds the locked mutex.
As a consequence, if _lwp_mutex_lock is interrupted,
an error indication such as EINTR is never returned to the caller.
If an LWP waiting on a mutex lock is interrupted by a signal,
the signal handler will run,
but _lwp_mutex_lock is always restarted so the lock is held on return.
_lwp_mutex_lock leaves the mutex in the locked state
and returns zero to the caller on success, or an error number for failure, as
If any of the following conditions is detected,
_lwp_mutex_lock fails and returns the corresponding value:
The mutual exclusion variable pointed to by mutex is invalid.
The mutex parameter points to an illegal address.
(This error may not be detected; a SIGSEGV signal may be posted to the
faulting LWP if an illegal address is used.)
The locks acquired with _lwp_mutex_lock should be released
Note that this primitive is used at the LWP level only,
and should not be used by threads.
Lightweight processes (LWPs) are internal interfaces and are subject
Their use should be avoided.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004