pthread_rwlock_timedwrlock

Locks the specified reader-writer lock for writing.

Library:LibC
Classification:POSIX
Service:Synchronization

Syntax

  #include <pthread.h>
   
  int pthread_rwlock_timedwrdlock (
     pthread_rwlock_t        *rwlock,
     const struct timespec   *abs_timeout);
  

Parameters

rwlock

(IN) Points to reader-writer lock that you want to lock for writing.

abs_timeout

(IN) Points to a timespec structure which specifies the maximum amount of time you are willing to wait. See timespec_t, which is also called timespec and timestrc_t.

Return Values

If successful, returns zero; otherwise, returns a nonzero error code:

Decimal

Constant

Description

9

EINVAL

The rwlock parameter does not point to a valid reader-writer lock.

60

ETIMEDOUT

The semaphore could not be locked before the specified timeout expired.

105

ENOCONTEXT

The calling thread has no context.

Remarks

If the lock is immediately available, the pthread_rwlock_timedwrlock function acquires the lock and returns. If the lock is not immediately available, the calling thread blocks and waits the specified time. If the lock becomes available during this time, the pthread_rwlock_timedwrlock function acquires the lock and returns. If it doesn't become available during this time, the function sets errno to ETIMEDOUT.

See Also