From nobody Mon Jul 27 16:12:35 2026 X-Original-To: dev-commits-src-main@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 4h83XM5sP7z6nBNZ for ; Mon, 27 Jul 2026 16:12:35 +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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h83XM58f7z42Wd for ; Mon, 27 Jul 2026 16:12:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785168755; 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=rQCD8RZzwbtPINB/h5YXcGSyykHo2NHtsnWLNgEiMEo=; b=nY6gEv2Xsa7OUDweddLQBQZi2EYV9opRnQVT6jmBPGmDoHpg3NbPQzQilaq6U6n0y66KQt HOzqWOqVU0DbMIbUXZsyEkCDvUAYoh195hrRhfWeMaK4l/kPlgh+5JPAix+QI6XxYeEaY7 NLdPV38glPObPSBjBZ1xvnpJmONHKSIV93D/P1d+bgIcfJStHsCzSrbgifH1xA8/uZTWyA Cc7hxDK65J4ROZWbv6Zk9dU354H3nyoaogXxEDOrzEFcYCD1vw8e4bTdmiEdZM4Ujb539U 159iRbtQ1hXO6u/xENwsmiKDK0XGfL/aTPK73/qyRD5ydaNy+c5x5gSUfhwTFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785168755; a=rsa-sha256; cv=none; b=WYT+I5z8oQkwbymOGry7Dw3upn3Lu6Y9VzDYWz/+H+Vm0kw1K/Ari1vj/GtLIfgWg3+k2b B/+bkt9t+/YrtgdQLABeb5Ijh1zJo/c925dwKSSwWmkN76WR+EzggHPRQSm541/B5hk764 Em5KLiS//OGDOX8aydgOLZt7ghBv/NCISDLvzrHgQ89LPhrR7EgdOSRCNB1F02H4Y37/0b 4LjZyWASL/A6i93+EvsrM7LI3F3LXlbutZt8tBOKcTTU7nz/I2+IKoamVbrZ5Sj2cuWXZV xWj8foJwpS2Q0+pW036M7OezVxA61VDbohecsRHCDgIbaOa2jcQDreh273uxPw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785168755; 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=rQCD8RZzwbtPINB/h5YXcGSyykHo2NHtsnWLNgEiMEo=; b=VQs/eAIJYNftjiKt55enRW0CqBUa0FzybsLJJkIbO65GdNk874ZHZS0JPf9UzrLhtr4vbh /wO9X2oL2Hn88Cj+PpkYu6gX8a/j+eQXrWKQcn8CdvDF3HGbG30o4HrQ4qAgpjXP6RsZzx VCrlR7MfuIO0ktEBTX5hBDpg041J3jjymuX0k3P+yQhvHhjQYnQwIOm0Fn+oFVidEpmXkV ibZ7LRCnzJmQogaHUj/k835rlc1tMMYG7Zy9MwN682aut+BjAnfTihpZgHCwnvVnIxh5mN U03Klp/h6IiisPoPLhdsHJb7Bx8qfliRm8PVfDPhAzdMMVVRUJ5tEUaZyke0vA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h83XM3nhjz1FMS for ; Mon, 27 Jul 2026 16:12:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1dc99 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 27 Jul 2026 16:12:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3c6f63902b03 - main - pthread_cond_wait.3: describe spurious wakeups List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: 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: 3c6f63902b037e36648fae435d4d5f56f9dc389b Auto-Submitted: auto-generated Date: Mon, 27 Jul 2026 16:12:35 +0000 Message-Id: <6a678373.1dc99.30c0735b@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3c6f63902b037e36648fae435d4d5f56f9dc389b commit 3c6f63902b037e36648fae435d4d5f56f9dc389b Author: Konstantin Belousov AuthorDate: 2026-07-25 20:02:24 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-27 16:12:12 +0000 pthread_cond_wait.3: describe spurious wakeups Reviewed by: markc Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D58458 --- share/man/man3/pthread_cond_wait.3 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/share/man/man3/pthread_cond_wait.3 b/share/man/man3/pthread_cond_wait.3 index c09e7aa68738..d26602c69cfc 100644 --- a/share/man/man3/pthread_cond_wait.3 +++ b/share/man/man3/pthread_cond_wait.3 @@ -45,13 +45,26 @@ variable specified by .Fa cond , and releases the mutex specified by .Fa mutex . -The waiting thread unblocks only after another thread calls +The waiting thread unblocks after another thread calls .Xr pthread_cond_signal 3 , or .Xr pthread_cond_broadcast 3 with the same condition variable, and the current thread reacquires the lock on .Fa mutex . +.Pp +It is possible that the +.Fn pthread_cond_wait +function returns without corresponding wakeup from either +.Fn pthread_cond_signal +or +.Fn pthread_cond_broadcast . +Such condition is called spurious wakeup, and is allowed by +.St -p1003.1-96 . +Applications should have a boolean expression used for each wait +on the condition variable, and recheck it after return from the +.Fn pthread_cond_wait +function. .Sh RETURN VALUES If successful, the .Fn pthread_cond_wait