Attempts to acquire a readers/writer lock in write access mode.
Syntax
tis_write_trylock(
lock );
Argument Data Type Access
lock opaque tis_rwlock_t write
C Binding
#include
int
tis_write_trylock (
tis_rwlock_t *lock);
Arguments
- lock
- Address of the readers/writer lock.
Description
This routine attempts to acquire a readers/writer lock in
write access mode. An attempt is made to immediately acquire the
lock. If the lock is acquired, 0 is returned. If the lock is held
by another thread (in either read access mode or write access mode),
EBUSY is returned and the caller does not wait for an eventual lock.
Note that if the lock is already held by the thread attempting to
acquire it in write access mode, that would be a coding error.
(EBUSY is returned anyway, however, because no ownership error
checking is done.)
Return Values
If an error condition occurs, this routine returns an integer value
indicating the type of error. Possible return values are as follows:
Return Description
0 Successful completion; the write lock is acquired.
[EBUSY] The lock in write access mode was NOT acquired, as it
is already held by another thread.
Associated Routines
tis_read_lock
tis_read_trylock
tis_read_unlock
tis_rwlock_destroy
tis_rwlock_init
tis_write_lock
tis_write_unlock