Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_rwlock_timedrdlock.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_rwlock_timedrdlock.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_rwlock_timedrdlock.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_rwlock_timedrdlock.html on line 8

pthread_rwlock_timedrdlock()

Lock a read-write lock for reading

Synopsis:

#include <pthread.h>
#include <time.h>

int pthread_rwlock_timedrdlock( 
                   pthread_rwlock_t * rwlock,
                   const struct timespec * abs_timeout );

Arguments:

rwlock
The read-write lock that you want to lock.
abs_timeout
A pointer to a timespec that specifies the maximum time to wait to acquire the lock, expressed as an absolute time.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_rwlock_timedrdlock() function applies a read lock to the read-write lock referenced by rwlock as in pthread_rwlock_rdlock().

However, if the lock can't be acquired without waiting for other threads to unlock it, this wait terminates when the specified timeout expires. The timeout expires when the absolute time specified by abs_timeout passes, as measured by the clock on which timeouts are based (i.e. when the value of that clock equals or exceed abs_timeout), or if the absolute time specified by abs_timeout has already been passed at the time of the call.

The timeout is based on the CLOCK_REALTIME clock.

If the read-write lock can be locked immediately, the validity of the abs_timeout parameter isn't checked, and the function won't fail with a timeout.

If a signal that causes a signal handler to be executed is delivered to a thread blocked on a read-write lock via a call to pthread_rwlock_timedrdlock(), upon return from the signal handler the thread resumes waiting for the lock as if it hadn't been interrupted.

The calling thread may deadlock if at the time the call is made it holds a write lock on rwlock. The results are undefined if this function is called with an uninitialized read-write lock.

Returns:

Zero if the lock for reading on the read-write lock object referenced by rwlock is acquired, or an error number to indicate the error.

Errors:

EAGAIN
Couldn't acquire read lock because the maximum number of read locks for lock would be exceeded.
EDEADLK
The calling thread already holds a write lock on rwlock.
EINVAL
The value specified by rwlock doesn't refer to an initialized read-write lock object, or the abs_timeout nanosecond value is less than zero or greater than or equal to 1,000 million.
ETIMEDOUT
The lock couldn't be acquired before the specified timeout expired.

Classification:

POSIX 1003.1 THR TMO

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

pthread_rwlock_destroy(), pthread_rwlock_init(), pthread_rwlock_timedwrlock(), pthread_rwlock_trywrlock(), pthread_rwlock_tryrdlock(), pthread_rwlock_unlock(), pthread_rwlock_wrlock(), timespec


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_rwlock_timedrdlock.html on line 181

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_rwlock_timedrdlock.html on line 181