int
pthread_mutex_lock(
pthread_mutex_t *mutex
)
int
pthread_mutex_trylock(
pthread_mutex_t *mutex
)
)
function locks
mutex
.
If the mutex is already locked, the calling thread will block until the
mutex becomes available.
The
pthread_mutex_trylock()
function locks
mutex
.
If the mutex is already locked,
pthread_mutex_trylock()
will not block waiting for the mutex, but will return an error condition.
)
and
pthread_mutex_trylock(
)
will return zero, otherwise an error number will be returned to
indicate the error.
)
may fail if:
EDEADLK
]
mutex
.
EINVAL
]
mutex
is invalid.
pthread_mutex_trylock()
shall fail if:
EBUSY
]
Mutex
is already locked.
pthread_mutex_trylock()
may fail if:
EINVAL
]
mutex
is invalid.
)
and
pthread_mutex_trylock(
)
conform to
ISO/IEC 9945-1:1996 (``POSIX.1'') .