mutex_trylock(3synch)
mutex_trylock --
conditionally lock a mutex
Synopsis
   cc [options] -Kthread file
   
   #include <synch.h>
   
   int mutex_trylock(mutex_t *mutex);
Description
mutex_trylock attempts once to lock the
mutual exclusion lock (mutex) pointed to by mutex.
Parameters
mutex- 
pointer to mutex to be locked
 
If mutex is available,
mutex_trylock will return successfully
with mutex locked.
If mutex is already locked,
mutex_trylock immediately returns EBUSY to the caller
without acquiring mutex or blocking.
mutex must previously have been initialized,
either by mutex_init, or statically (see
mutex_init(3synch)).
Usage
mutex_trylock is used when the caller does not want to block.
Mutexes acquired with mutex_trylock should be released
with mutex_unlock.
Return values
mutex_trylock returns zero for success
and an error number for failure.
Errors
If the following condition occurs,
mutex_trylock returns the corresponding value:
EBUSY- 
mutex is already locked
 
If the following condition is detected,
mutex_trylock fails and returns the corresponding value:
EINVAL- 
invalid argument specified
 
References
Intro(3synch),
mutex(3synch),
mutex_destroy(3synch),
mutex_init(3synch),
mutex_lock(3synch),
mutex_unlock(3synch)
© 2004 The SCO Group, Inc.  All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004