Standard C Library Functions pthreadrwlocktimedwrlock(3C)
NAME
pthreadrwlocktimedwrlock, pthreadrwlockreltimedwrlocknp
- lock a read-write lock for writing
SYNOPSIS
cc -mt [ flag... ] file... [ library... ]
#include
#include
int pthreadrwlocktimedwrlock(pthreadrwlockt *restrict rwlock,
const struct timespec *restrict abstimeout);
int pthreadrwlockreltimedwrlocknp(pthreadrwlockt *restrict rwlock,
const struct timespec *restrict reltimeout);
DESCRIPTION
The pthreadrwlocktimedwrlock() function applies a write
lock to the read-write lock referenced by rwlock as in the
pthreadrwlockwrlock(3C) function. If the lock cannot be
acquired without waiting for other threads to unlock the
lock, this wait will be terminated when the specified
timeout expires. The timeout expires when the absolute time
specified by abstimeout passes, as measured by the
CLOCKREALTIME clock (that is, when the value of that clock
equals or exceeds abstimeout), or if the absolute time
specified by abstimeout has already been passed at the time
of the call.
The pthreadrwlockreltimedwrlocknp() function is identical
to the pthreadrwlocktimedwrlock() function, except that
the timeout is specified as a relative time interval. The
timeout expires when the time interval specified by
reltimeout passes, as measured by the CLOCKREALTIME clock,
or if the time interval specified by reltimeout is negative
at the time of the call.
The resolution of the timeout is the resolution of the
CLOCKREALTIME clock. The timespec data type is defined in
the header. Under no circumstances does either
function fail with a timeout if the lock can be acquired
immediately. The validity of the abstimeout parameter need
not be checked if the lock can be immediately acquired.
If a signal that causes a signal handler to be executed is
delivered to a thread blocked on a read- write lock with a
call to pthreadrwlocktimedwrlock() or
pthreadrwlockreltimedwrlocknp(), upon return from the
SunOS 5.11 Last change: 30 Jan 2004 1
Standard C Library Functions pthreadrwlocktimedwrlock(3C)
signal handler the thread resumes waiting for the lock as if
it was not interrupted.
The calling thread can deadlock if at the time the call is
made it holds the read-write lock. The results are undefined
if this function is called with an uninitialized read-write
lock.
RETURN VALUES
The pthreadrwlocktimedwrlock() and
pthreadrwlockreltimedwrlocknp() functions return 0 if the
lock for writing on the read-write lock object referenced by
rwlock is acquired. Otherwise, an error number is returned
to indicate the error.
ERORS
The pthreadrwlocktimedwrlock() and
pthreadrwlockreltimedwrlocknp() functions will fail if:
ETIMEDOUT The lock could not be acquired before the
specified timeout expired.
The pthreadrwlocktimedwrlock() and
pthreadrwlockreltimedwrlocknp() functions may fail if:
EDEADLK The calling thread already holds the rwlock.
EINVAL The value specified by rwlock does not refer to
an initialized read-write lock object, or the
timeout nanosecond value is less than zero or
greater than or equal to 1,000 million.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 30 Jan 2004 2
Standard C Library Functions pthreadrwlocktimedwrlock(3C)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability See below.
MT-Level MT-Safe
The pthreadrwlocktimedwrlock() function is Standard. The
pthreadrwlockreltimedwrlocknp() function is Stable.
SEE ALSO
pthreadrwlockdestroy(3C), pthreadrwlockrdlock(3C),
pthreadrwlocktimedrdlock(3C),
pthreadrwlocktrywrlock(3C), pthreadrwlockunlock(3C),
pthreadrwlockwrlock(3C), attributes(5), standards(5)
SunOS 5.11 Last change: 30 Jan 2004 3
|