From nobody Tue Nov 10 00:22:15 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jNnQw1Ssjz70lVd for ; Tue, 10 Nov 2026 00:22:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jNnQv3W41z3R78 for ; Tue, 10 Nov 2026 00:22:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794270135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sBk232yD2E2PxU3RdeC/nvO1uYQKcjMMf36WZLAkhQ4=; b=kXVffwH7/3TbISWh2eWw7fKQ/eVrPidLOwWb96css0HHtHsKax0qf5aoD2mxUh2Z0+tA/o Be2eoyqVZ7ueixmayF58UdMeofRmxwxy/ppTL9sKXPnK4C1AHTQ4ecSHHrwtNB8Ma+ieKN Za5llZ8XGI320bHRrHP3+dwazYTJCo6Yxo11fciIbdJd62NO/8Je8jTgHaXuCdotOa9Rqe XauXivlmqzfViqzL7CZ+UsGnFJKSUhy9EaAHVJsGBmYtdJcOCTex2qmF5wT8wqw96RQyzq QkeembGEbpluNRvxKt5z+zWi5O+jVdcObtYb+xI4sTt9G1qP8iXyhxpMkw4d9Q== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794270135; b=qq2/NlW92EMvAaRV43ZOZ4D2HHVEDKMM8HOk6m5429kPO2rVFfy1/QUeb62DyIVBWa2+rN VH0MUFJLTynFBv7w31Y3g4ZKMr8NBT23ZTW7vWaxR+5PodoAUPCnapOMrs9gtFqvNxvhPZ 1aB7tczY3ahdLp0PVwF55jSUAnt5i6ekFua5xa4DoywA9xNJ0PK0bAoOIQ7iAaFjU+jDCY RO7tQTLUHNSjzpkaziqbJdEpIdXfQC3kV65lCv//y0hgLYv9bcMJGhPg0Xvup5oESruNIl FUcKHrFVcdrwjz09HiE/OxCTdbyaquBjcIIhBmIVU095amn/TNqk8YMB7gtVFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794270135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sBk232yD2E2PxU3RdeC/nvO1uYQKcjMMf36WZLAkhQ4=; b=Z3KTtKhjZHVIDWzlrhtoPUiSrl1N75lldWn2vZ3BWdJuNJz1iqCZEDbhtOb46FJbTddF5K RIO3MlOBq0pMZOoCtXiHwW9U2QgxFUKsBWDL3hgkVm8cC5vygXhpdTlC9c8IiRLyTmTV41 IRRXFZJMs9hsTqioUI7GlluAOYyNvufdq+LO6MYNklDNyBzbxpoFpByr4g1vJjucNVCMXl fF5XE0FQGzFk74RhXxtADcUkbXpO77i5/qW2/4TQSjEx9ptyjHf6Wq4s5KoZsgjiFzZFxU 0xMSk3c2BuHJ01V3x4aXOCWfq82xquKo47pSkVfHtvxntlXgy0PE53iOyxW6vg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jNnQv2tBlz13Zy for ; Tue, 10 Nov 2026 00:22:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id f944 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 10 Nov 2026 00:22:15 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 522407f54078 - main - pthread_rwlock_clock{rd,wr}lock(3): document List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 522407f54078e986bca5a74c8335881c6a1afe81 Auto-Submitted: auto-generated Date: Tue, 10 Nov 2026 00:22:15 +0000 Message-Id: <6af263b7.f944.39b4be96@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=522407f54078e986bca5a74c8335881c6a1afe81 commit 522407f54078e986bca5a74c8335881c6a1afe81 Author: Konstantin Belousov AuthorDate: 2026-11-05 22:40:23 +0000 Commit: Konstantin Belousov CommitDate: 2026-11-10 00:21:19 +0000 pthread_rwlock_clock{rd,wr}lock(3): document Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D61253 --- share/man/man3/Makefile | 2 + share/man/man3/pthread_rwlock_timedrdlock.3 | 62 ++++++++++++++++++++--------- share/man/man3/pthread_rwlock_timedwrlock.3 | 62 ++++++++++++++++++++--------- 3 files changed, 88 insertions(+), 38 deletions(-) diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index 4d80fea05b88..7893193fe357 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -530,6 +530,8 @@ PTHREAD_MLINKS+=pthread_mutexattr.3 pthread_mutexattr_destroy.3 \ PTHREAD_MLINKS+=pthread_mutexattr_getkind_np.3 pthread_mutexattr_setkind_np.3 PTHREAD_MLINKS+=pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3 PTHREAD_MLINKS+=pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3 +PTHREAD_MLINKS+=pthread_rwlock_timedwrlock.3 pthread_rwlock_clockwrlock.3 +PTHREAD_MLINKS+=pthread_rwlock_timedrdlock.3 pthread_rwlock_clockrdlock.3 PTHREAD_MLINKS+=pthread_schedparam.3 pthread_getschedparam.3 \ pthread_schedparam.3 pthread_setschedparam.3 PTHREAD_MLINKS+=pthread_set_name_np.3 pthread_get_name_np.3 \ diff --git a/share/man/man3/pthread_rwlock_timedrdlock.3 b/share/man/man3/pthread_rwlock_timedrdlock.3 index 4feb6c9910a0..778c61b1349e 100644 --- a/share/man/man3/pthread_rwlock_timedrdlock.3 +++ b/share/man/man3/pthread_rwlock_timedrdlock.3 @@ -26,6 +26,7 @@ .Dt PTHREAD_RWLOCK_TIMEDRDLOCK 3 .Os .Sh NAME +.Nm pthread_rwlock_clockrdlock , .Nm pthread_rwlock_timedrdlock .Nd "acquire a read-write lock for reading or give up after a specified period" .Sh LIBRARY @@ -33,19 +34,32 @@ .Sh SYNOPSIS .In pthread.h .Ft int +.Fo pthread_rwlock_clockrdlock +.Fa "pthread_rwlock_t *restrict rwlock" +.Fa "clockid_t clockid" +.Fa "const struct timespec *restrict abs_timeout" +.Fc +.Ft int .Fo pthread_rwlock_timedrdlock .Fa "pthread_rwlock_t *restrict rwlock" .Fa "const struct timespec *restrict abs_timeout" .Fc .Sh DESCRIPTION -This function acquires a read lock on the read-write lock +These functions acquire a read lock on the read-write lock .Fa rwlock . However, if the lock cannot be acquired without waiting for another thread to unlock the lock, -this wait shall be terminated when +this wait is terminated when .Fa abs_timeout expires. +The +.Fa abs_timeout +value is an absolute time, measured on +.Fa clockid +for the clock variant and on +.Dv CLOCK_REALTIME +for the timed variant. .Pp A thread may hold multiple concurrent read locks. The @@ -53,38 +67,30 @@ The function must be called once for each lock acquired. .Pp If the thread should be interrupted by a signal, -the -.Fn pthread_rwlock_timedrdlock -function will be automatically restarted after the thread returns from -the signal handler. +the functions are automatically restarted after the thread +returns from the signal handler. .Pp The calling thread may deadlock if at the time the call is made it holds a write lock on .Fa rwlock . -The results are undefined if this function is called with +The results are undefined if these functions are called with an uninitialized read-write lock. .Sh IMPLEMENTATION NOTES To prevent writer starvation, writers are favored over readers. .Sh RETURN VALUES -If successful, the -.Fn pthread_rwlock_timedrdlock -function will return zero. +If successful, the functions will return zero. Otherwise, an error number will be returned to indicate the error. .Pp -This function shall not return an error code of +These functions do not return an error code of .Er EINTR . .Sh ERRORS -The -.Fn pthread_rwlock_timedrdlock -function will fail if: +The functions will fail if: .Bl -tag -width Er .It Bq Er ETIMEDOUT The lock could not be acquired before the specified timeout expired. .El .Pp -The -.Fn pthread_rwlock_timedrdlock -function may fail if: +The functions may fail if: .Bl -tag -width Er .It Bq Er EAGAIN The read lock could not be @@ -101,7 +107,17 @@ does not refer to an initialized read-write lock object, or the .Fa abs_timeout nanosecond value is less than zero or -greater than or equal to 1 billion. +greater than or equal to 1 billion, or the +.Fa clockid +parameter is invalid. +.Pp +The +.Dv CLOCK_REALTIME +and +.Dv CLOCK_MONOTONIC +clocks are always supported; see +.Xr _umtx_op 2 +for the full list of accepted clocks. .El .Sh SEE ALSO .Xr pthread_rwlock_init 3 , @@ -110,10 +126,18 @@ greater than or equal to 1 billion. .Sh STANDARDS The .Fn pthread_rwlock_timedrdlock -function is expected to conform to +function conforms to .St -p1003.1-96 . +The +.Fn pthread_rwlock_clockrdlock +function conforms to +.St -p1003.1-2024 . .Sh HISTORY The .Fn pthread_rwlock_timedrdlock function first appeared in .Fx 5.2 . +The +.Fn pthread_rwlock_clockrdlock +function first appeared in +.Fx 16.0 . diff --git a/share/man/man3/pthread_rwlock_timedwrlock.3 b/share/man/man3/pthread_rwlock_timedwrlock.3 index c3267d694534..89d76d42834f 100644 --- a/share/man/man3/pthread_rwlock_timedwrlock.3 +++ b/share/man/man3/pthread_rwlock_timedwrlock.3 @@ -26,6 +26,7 @@ .Dt PTHREAD_RWLOCK_TIMEDWRLOCK 3 .Os .Sh NAME +.Nm pthread_rwlock_clockwrlock , .Nm pthread_rwlock_timedwrlock .Nd "acquire a read-write lock for writing or give up after a specified period" .Sh LIBRARY @@ -33,53 +34,58 @@ .Sh SYNOPSIS .In pthread.h .Ft int +.Fo pthread_rwlock_clockwrlock +.Fa "pthread_rwlock_t *restrict rwlock" +.Fa "clockid_t clockid" +.Fa "const struct timespec *restrict abs_timeout" +.Fc +.Ft int .Fo pthread_rwlock_timedwrlock .Fa "pthread_rwlock_t *restrict rwlock" .Fa "const struct timespec *restrict abs_timeout" .Fc .Sh DESCRIPTION -This function acquires a write lock on the read-write lock +These functions acquire a write lock on the read-write lock .Fa rwlock . However, if the lock cannot be acquired without waiting for another thread to unlock the lock, -this wait shall be terminated when +this wait is terminated when .Fa abs_timeout expires. +The +.Fa abs_timeout +value is an absolute time, measured on +.Fa clockid +for the clock variant and on +.Dv CLOCK_REALTIME +for the timed variant. .Pp If the thread should be interrupted by a signal, -the -.Fn pthread_rwlock_timedwrlock -function will be automatically restarted after the thread returns from -the signal handler. +the functions are automatically restarted after the thread +returns from the signal handler. .Pp The calling thread may deadlock if at the time the call is made it holds .Fa rwlock . -The results are undefined if this function is called with +The results are undefined if these functions are called with an uninitialized read-write lock. .Sh IMPLEMENTATION NOTES To prevent writer starvation, writers are favored over readers. .Sh RETURN VALUES -If successful, the -.Fn pthread_rwlock_timedwrlock -function will return zero. +If successful, the functions will return zero. Otherwise, an error number will be returned to indicate the error. .Pp -This function shall not return an error code of +These functions do not return an error code of .Er EINTR . .Sh ERRORS -The -.Fn pthread_rwlock_timedwrlock -function shall fail if: +The functions will fail if: .Bl -tag -width Er .It Bq Er ETIMEDOUT The lock could not be acquired before the specified timeout expired. .El .Pp -The -.Fn pthread_rwlock_timedwrlock -function may fail if: +The functions may fail if: .Bl -tag -width Er .It Bq Er EDEADLK The calling thread already holds @@ -91,7 +97,17 @@ does not refer to an initialized read-write lock object, or the .Fa abs_timeout nanosecond value is less than zero or -greater than or equal to 1 billion. +greater than or equal to 1 billion, or the +.Fa clockid +parameter is invalid. +.Pp +The +.Dv CLOCK_REALTIME +and +.Dv CLOCK_MONOTONIC +clocks are always supported; see +.Xr _umtx_op 2 +for the full list of accepted clocks. .El .Sh SEE ALSO .Xr pthread_rwlock_init 3 , @@ -100,10 +116,18 @@ greater than or equal to 1 billion. .Sh STANDARDS The .Fn pthread_rwlock_timedwrlock -function is expected to conform to +function conforms to .St -p1003.1-96 . +The +.Fn pthread_rwlock_clockwrlock +function conforms to +.St -p1003.1-2024 . .Sh HISTORY The .Fn pthread_rwlock_timedwrlock function first appeared in .Fx 5.2 . +The +.Fn pthread_rwlock_clockwrlock +function first appeared in +.Fx 16.0 .