[LTP] [PATCH] openposix: pthread_join/speculative/6-1: Fix race with detached thread exit
Martin Doucha
mdoucha@suse.cz
Fri Nov 13 14:34:13 CET 2026
On 11/12/26 22:49, Avinesh Kumar via ltp wrote:
> From: Avinesh Kumar <avinesh.kumar@suse.com>
>
> The test creates a detached thread whose body returns immediately, then
> expects pthread_join() on its ID to fail with EINVAL. Once the thread has
> exited, its ID is no longer valid and the behavior is undefined. The
> outcome depends on scheduling, so the test fails sporadically, mostly
> on single CPU machines.
>
> Keep the thread blocked on a semaphore until pthread_join() has returned.
I believe we've already had a discussion about this test. Calling
pthread_join() on detached threads is undefined behavior according to
the latest POSIX standard. The test should simply be dropped.
https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_join.html
--
Martin Doucha mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
More information about the ltp
mailing list