PTHREAD_RWLOCK_TIMEDWRLOCK(3)
πΈ PTHREAD_RWLOCK_TIMEDWRLOCK(3) πΈ
β¨ NAME β¨
pthread_rwlock_timedwrlock β acquire a read-write lock for writing or give up after a specified period
π«Ά LIBRARY π«Ά
POSIX Threads Library (libpthread, -lpthread) β and yes bestie, this is a Library Functions Manual page. Manifesting that link line for you β¨
π SYNOPSIS π
#include <pthread.h>
int
pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict rwlock,
const struct timespec *restrict abs_timeout);
π DESCRIPTION π
Okay so this function acquires a write lock on the read-write lock rwlock. Main character energy only π₯
But if the lock cannot be acquired without waiting for another thread to unlock the lock, this wait shall be terminated when abs_timeout expires. So you wait, but only until your deadline says βbestie, noβ β°
If the thread should be interrupted by a signal, the pthread_rwlock_timedwrlock() function will be automatically restarted after the thread returns from the signal handler. Resilient queen behavior π
π¨ Deadlock warning: the calling thread may deadlock if at the time the call is made it holds rwlock. Like, do not do that to yourself, fr fr π
π Undefined alert: the results are undefined if this function is called with an uninitialized read-write lock. No cap, initialize it first.
π οΈ IMPLEMENTATION NOTES π οΈ
To prevent writer starvation, writers are favored over readers. Writers stay booked and busy, periodt π
π RETURN VALUES π
If successful, the pthread_rwlock_timedwrlock() function will return zero. Otherwise, an error number will be returned to indicate the error.
This function shall not return an error code of EINTR. Not a thing here, bestie π«
π ERRORS π
The pthread_rwlock_timedwrlock() function shall fail if:
[ETIMEDOUT]β the lock could not be acquired before the specified timeout expired. Timeβs up, icon π°οΈ
The pthread_rwlock_timedwrlock() function may fail if:
[EDEADLK]β the calling thread already holdsrwlock. Self-deadlock vibes, absolutely not π[EINVAL]β the value specified byrwlockdoes not refer to an initialized read-write lock object, or theabs_timeoutnanosecond value is less than zero or greater than or equal to 1 billion. Check your numbers, babe π’
π SEE ALSO π
Go read the whole friend group, iykyk π«Ά
β STANDARDS β
The pthread_rwlock_timedwrlock() function is expected to conform to ISO/IEC 9945-1:1996 (βPOSIX.1β). Certified standards girlie behavior π
π¦ HISTORY π¦
The pthread_rwlock_timedwrlock() function first appeared in FreeBSD 5.2. A historical slay β¨
Debian Β· August 17, 2018 Β· PTHREAD_RWLOCK_TIMEDWRLOCK(3) β thatβs the footer, bestie, and weβre done. Mwah ππ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2004 Michael Telahun Makonnen
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms