| Message ID | 20251101193213.684326-2-hi@alyssa.is (mailing list archive) |
|---|---|
| State | Changes Requested |
| Headers |
Return-Path: <libc-alpha-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 72FDA3858C40 for <patchwork@sourceware.org>; Sat, 1 Nov 2025 21:44:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 72FDA3858C40 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=alyssa.is header.i=@alyssa.is header.a=rsa-sha256 header.s=fm2 header.b=YNfXjqV2; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=aLxNciY+ X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from fout-a5-smtp.messagingengine.com (fout-a5-smtp.messagingengine.com [103.168.172.148]) by sourceware.org (Postfix) with ESMTPS id 983553858D21 for <libc-alpha@sourceware.org>; Sat, 1 Nov 2025 21:43:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 983553858D21 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=alyssa.is Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alyssa.is ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 983553858D21 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=103.168.172.148 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762033411; cv=none; b=Aoj80D8XBz0ET4NL+B5fIVXdRr14vPL98cqz99reaXRMiMDXo//Js7fcFj+6p2wy+yKNDB0PQ7Ul+MhiChh5CUVf2Hwf7b94dpjjn+z8Xd2fmkdlwUsmkXzuMkYqVi88siowJOX0UAOcHn8tVR6SmtqqRE1Rzi22q3t1xHhUDHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762033411; c=relaxed/simple; bh=509l8l6PlfI2m7eZsvtA2crWY4TGXYKn5XBhBdQRz9k=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=PT3CyMHYlzItczkB4jIVSBlDZWQP7y7rxCV3Zq6CrRESP7s6BxLqjqgWDj0vTwjy7K51vbqyLI8O0DpiFUeQNWDUNbn0MhtIGJxrSlchwJk+YjwpIuXmUCruYDq5407oT+XcmiWaLQbY2CQdZhbVVDE/ceditqe6fEUCLORSU8c= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 983553858D21 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 4C683EC0122 for <libc-alpha@sourceware.org>; Sat, 1 Nov 2025 17:43:30 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Sat, 01 Nov 2025 17:43:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to; s=fm2; t=1762033410; x=1762119810; bh=1uKITDBcizIgYx7BzoDHH o5kLSFuYxA7iRaJcBWckUY=; b=YNfXjqV2BYRs8gIXgNhZ3SFXeHrFDWnFVKp5y 8aqHpIZvEpKS9CGoDNV5XesVpBMcX8TSJ80yGupd6UoGGzWRX7T4VLnFgfePfPaT IdVqgk2uyXHVkIMQ4wIRLFv9ihNme1oEiZPdxX4fMytkGRmKjmbUJcv4Taxgvm0h Jireop/fG2+hEmPeCr5NB7NtorTqiKjJyFvqZ0cpChxbQ7WsvZ8VlCcVeNw1uMda V+DfIfhEPN+D2XfRhYR/sA0+L1ky3J97M+cOJyD/kRpuJ50P62cbgWg5I2qahZ8e 3QjTDHgYZL1eLupmI+VqooXl+Xc54yczS/x5IcKU0ed474R2g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1762033410; x=1762119810; bh=1uKITDBcizIgYx7BzoDHHo5kLSFuYxA7iRa JcBWckUY=; b=aLxNciY+9fKCYKiaXqKbSCXN5VQQUHcocWtcVSMgNdAK+VWZu6F N+vSvyxdBNy43hDRZLSD1RmzRSPKPQ3Dq2Q1Jr80PW5/bv4WuT51O+OknCe3sLBZ w3xmDsE4yFM9IfQ4C+CxHgksM5aqzgEGChtv10TvG7dfOXljdVMbv9/XJ3R/eif2 8alcHwz2NQO74/wbDdahn+7o7inVC0Z9CeFWl4IzDACOVJ4WffGbrgosH8s16grw 9dQv/TWbxe8d2EbxDvHK9WS+rXI88ZNs+Wtedyd+p+PmBFXvWBOBohv3CCMEEyRt qebB/jfu2SB6jpfN/INRslJWtMB6FokcAIg== X-ME-Sender: <xms:An8GabJMUT0lt1OG9bmlSOnEHFwQSvmAuh4qjasNM3EOQxq0iKiMeg> <xme:An8GaVAlO6n_Q424n2gO4G8batCqUOkjopFb88_mO5fdY8LHYY6Hz-OEOrKcWgR_5 M9WnAyi0xPpidOLpguHUWOMGuvNexTFe1bSk42lzfc-N3f7dncNtA> X-ME-Received: <xmr:An8GaeyPJQAKldomIqOnwCls_0vdF41JGcjYivzQJ6RJEhfmgwfsd8MgH2gzoHQ> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddujeefgeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdekredtredttd enucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhisheqnecu ggftrfgrthhtvghrnheptdehgeelgeeuuedtleehgfdthfeiieelfffhffelueefudffgf eiieeivdejffetnecuffhomhgrihhnpeduqddvtddvgedrihhnpdhsohhurhgtvgifrghr vgdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehhihesrghlhihsshgrrdhishdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhht phhouhhtpdhrtghpthhtoheplhhisggtqdgrlhhphhgrsehsohhurhgtvgifrghrvgdroh hrgh X-ME-Proxy: <xmx:An8GaRNkfMu1hUeuaMalilqKctUlYH21Vx9MahM_9N9XDFVKZgllJw> <xmx:An8GaV8Zhp1zwsULFw8ai1Sn-u9kEgzg3KlKyAFjDCbUVR3J-mfHsg> <xmx:An8GaZqo7brCqikgYqgCUcOfeiHUe4rzKJ45Yl54_tu3_YQrB4si4w> <xmx:An8Gaf4ayLcDMzoxwfcMxx9MuKCgHgcHcQK9x8-gALfdn0PyJd0nHA> <xmx:An8GaS6ATiggncOUiEjy1Kj8UHmOUQFhmE7BDkgUkp3EH-MhXjRl-SM8> Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for <libc-alpha@sourceware.org>; Sat, 1 Nov 2025 17:43:29 -0400 (EDT) Received: by mbp.qyliss.net (Postfix, from userid 1000) id 15FA06326100; Sat, 01 Nov 2025 22:43:29 +0100 (CET) From: Alyssa Ross <hi@alyssa.is> To: libc-alpha@sourceware.org Subject: [PATCH] pthread: add PTHREAD_NULL Date: Sat, 1 Nov 2025 20:32:14 +0100 Message-ID: <20251101193213.684326-2-hi@alyssa.is> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
pthread: add PTHREAD_NULL
|
|
Checks
| Context | Check | Description |
|---|---|---|
| redhat-pt-bot/TryBot-apply_patch | success | Patch applied to master at the time it was sent |
| redhat-pt-bot/TryBot-32bit | success | Build for i686 |
Commit Message
Alyssa Ross
Nov. 1, 2025, 7:32 p.m. UTC
New in POSIX.1-2024. In htl, pthread_t values are integers starting at 1, so 0 is a safe null value. In nptl, pthread_t values are non-null pointers, so 0 is a safe null value. --- I wasn't sure whether this should be behind a __USE macro, but there isn't one for POSIX.1-2024 yet: https://inbox.sourceware.org/libc-alpha/d34488044ace7c01311fb1c1948e65a050e93252.1747972803.git.collin.funk1@gmail.com/ manual/threads.texi | 5 +++++ sysdeps/htl/pthread.h | 2 ++ sysdeps/nptl/pthread.h | 3 +++ 3 files changed, 10 insertions(+) base-commit: 720e89163702ffa1e921d926b6c36b53c3ccbee4
Comments
Hi Alyssa, Alyssa Ross <hi@alyssa.is> writes: > New in POSIX.1-2024. > > In htl, pthread_t values are integers starting at 1, so 0 is a safe > null value. > > In nptl, pthread_t values are non-null pointers, so 0 is a safe null > value. > --- > I wasn't sure whether this should be behind a __USE macro, but there > isn't one for POSIX.1-2024 yet: > https://inbox.sourceware.org/libc-alpha/d34488044ace7c01311fb1c1948e65a050e93252.1747972803.git.collin.funk1@gmail.com/ > > manual/threads.texi | 5 +++++ > sysdeps/htl/pthread.h | 2 ++ > sysdeps/nptl/pthread.h | 3 +++ > 3 files changed, 10 insertions(+) > > diff --git a/manual/threads.texi b/manual/threads.texi > index 1e9be32d66..d3692e8939 100644 > --- a/manual/threads.texi > +++ b/manual/threads.texi > @@ -1099,6 +1099,11 @@ This function gets the kind of mutex @var{mutex} is. > @node POSIX Threads Other APIs > @subsection POSIX Threads Other APIs > > +@deftypevr Macro pthread_t PTHREAD_NULL > +@standards{POSIX.1-2024, pthread.h} > +A value for pthread_t that is not considered equal to any thread ID. > +@end deftypevr > + > @deftypefun int pthread_equal (pthread_t @var{thread1}, pthread_t @var{thread2}) > Compares two thread IDs. If they are the same, returns nonzero, else returns zero. > @manpagefunctionstub{pthread_equal, 3} > diff --git a/sysdeps/htl/pthread.h b/sysdeps/htl/pthread.h > index a299fec278..d490f3cdf8 100644 > --- a/sysdeps/htl/pthread.h > +++ b/sysdeps/htl/pthread.h > @@ -55,6 +55,8 @@ __BEGIN_DECLS > > #include <bits/pthread.h> > > +#define PTHREAD_NULL ((pthread_t)0) > + > /* Possible values for the process shared attribute. */ > #define PTHREAD_PROCESS_PRIVATE __PTHREAD_PROCESS_PRIVATE > #define PTHREAD_PROCESS_SHARED __PTHREAD_PROCESS_SHARED > diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h > index 92957a620d..b47b732a9f 100644 > --- a/sysdeps/nptl/pthread.h > +++ b/sysdeps/nptl/pthread.h > @@ -33,6 +33,9 @@ > # include <bits/pthread_stack_min-dynamic.h> > #endif > > +#define PTHREAD_NULL ((pthread_t)0) > + > + > /* Detach state. */ > enum > { > > base-commit: 720e89163702ffa1e921d926b6c36b53c3ccbee4 I don't think this will cause conform tests to fail since PTHREAD_* is allowed. But it should probably be hidden under __USE_XOPEN2K24 which is not yet introduced. I have an old patch that is still waiting on review [1]. Collin [1] https://inbox.sourceware.org/libc-alpha/d34488044ace7c01311fb1c1948e65a050e93252.1747972803.git.collin.funk1@gmail.com/
On 11/1/25 5:51 PM, Collin Funk wrote: > Hi Alyssa, > > Alyssa Ross <hi@alyssa.is> writes: > >> New in POSIX.1-2024. >> >> In htl, pthread_t values are integers starting at 1, so 0 is a safe >> null value. >> >> In nptl, pthread_t values are non-null pointers, so 0 is a safe null >> value. >> --- >> I wasn't sure whether this should be behind a __USE macro, but there >> isn't one for POSIX.1-2024 yet: >> https://inbox.sourceware.org/libc-alpha/d34488044ace7c01311fb1c1948e65a050e93252.1747972803.git.collin.funk1@gmail.com/ >> >> manual/threads.texi | 5 +++++ >> sysdeps/htl/pthread.h | 2 ++ >> sysdeps/nptl/pthread.h | 3 +++ >> 3 files changed, 10 insertions(+) >> >> diff --git a/manual/threads.texi b/manual/threads.texi >> index 1e9be32d66..d3692e8939 100644 >> --- a/manual/threads.texi >> +++ b/manual/threads.texi >> @@ -1099,6 +1099,11 @@ This function gets the kind of mutex @var{mutex} is. >> @node POSIX Threads Other APIs >> @subsection POSIX Threads Other APIs >> >> +@deftypevr Macro pthread_t PTHREAD_NULL >> +@standards{POSIX.1-2024, pthread.h} >> +A value for pthread_t that is not considered equal to any thread ID. >> +@end deftypevr >> + >> @deftypefun int pthread_equal (pthread_t @var{thread1}, pthread_t @var{thread2}) >> Compares two thread IDs. If they are the same, returns nonzero, else returns zero. >> @manpagefunctionstub{pthread_equal, 3} >> diff --git a/sysdeps/htl/pthread.h b/sysdeps/htl/pthread.h >> index a299fec278..d490f3cdf8 100644 >> --- a/sysdeps/htl/pthread.h >> +++ b/sysdeps/htl/pthread.h >> @@ -55,6 +55,8 @@ __BEGIN_DECLS >> >> #include <bits/pthread.h> >> >> +#define PTHREAD_NULL ((pthread_t)0) >> + >> /* Possible values for the process shared attribute. */ >> #define PTHREAD_PROCESS_PRIVATE __PTHREAD_PROCESS_PRIVATE >> #define PTHREAD_PROCESS_SHARED __PTHREAD_PROCESS_SHARED >> diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h >> index 92957a620d..b47b732a9f 100644 >> --- a/sysdeps/nptl/pthread.h >> +++ b/sysdeps/nptl/pthread.h >> @@ -33,6 +33,9 @@ >> # include <bits/pthread_stack_min-dynamic.h> >> #endif >> >> +#define PTHREAD_NULL ((pthread_t)0) >> + >> + >> /* Detach state. */ >> enum >> { >> >> base-commit: 720e89163702ffa1e921d926b6c36b53c3ccbee4 > > I don't think this will cause conform tests to fail since PTHREAD_* is > allowed. But it should probably be hidden under __USE_XOPEN2K24 which is > not yet introduced. I have an old patch that is still waiting on review > [1]. That's stuck in my queue for review and I haven't gotten to it yet, but I agree it should likely go under some conditional e.g. __USE_XOPEN2K24. I should finish the review for you for the additional constants. Let me see if I can get that off my plate. > Collin > > [1] https://inbox.sourceware.org/libc-alpha/d34488044ace7c01311fb1c1948e65a050e93252.1747972803.git.collin.funk1@gmail.com/ >
diff --git a/manual/threads.texi b/manual/threads.texi index 1e9be32d66..d3692e8939 100644 --- a/manual/threads.texi +++ b/manual/threads.texi @@ -1099,6 +1099,11 @@ This function gets the kind of mutex @var{mutex} is. @node POSIX Threads Other APIs @subsection POSIX Threads Other APIs +@deftypevr Macro pthread_t PTHREAD_NULL +@standards{POSIX.1-2024, pthread.h} +A value for pthread_t that is not considered equal to any thread ID. +@end deftypevr + @deftypefun int pthread_equal (pthread_t @var{thread1}, pthread_t @var{thread2}) Compares two thread IDs. If they are the same, returns nonzero, else returns zero. @manpagefunctionstub{pthread_equal, 3} diff --git a/sysdeps/htl/pthread.h b/sysdeps/htl/pthread.h index a299fec278..d490f3cdf8 100644 --- a/sysdeps/htl/pthread.h +++ b/sysdeps/htl/pthread.h @@ -55,6 +55,8 @@ __BEGIN_DECLS #include <bits/pthread.h> +#define PTHREAD_NULL ((pthread_t)0) + /* Possible values for the process shared attribute. */ #define PTHREAD_PROCESS_PRIVATE __PTHREAD_PROCESS_PRIVATE #define PTHREAD_PROCESS_SHARED __PTHREAD_PROCESS_SHARED diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h index 92957a620d..b47b732a9f 100644 --- a/sysdeps/nptl/pthread.h +++ b/sysdeps/nptl/pthread.h @@ -33,6 +33,9 @@ # include <bits/pthread_stack_min-dynamic.h> #endif +#define PTHREAD_NULL ((pthread_t)0) + + /* Detach state. */ enum {