CVS commit: src/lib/libpthread

"YAMAMOTO Takashi" <[email protected]>
Newsgroups gmane.os.netbsd.devel.cvs
Message-ID <[email protected]>
Module Name:	src
Committed By:	yamt
Date:		Tue May  5 09:49:11 UTC 2026

Modified Files:
	src/lib/libpthread: pthread.c pthread_int.h

Log Message:
libpthread: fix pthread_main_np

the previous implementation was incorrect as pthread_t
of the main thread can be recycled via pthread__deadqueue.

with this changes, my test program [1] produces the same
result as macOS.

[1] https://github.com/yamt/garbage/tree/a24535e948dc62dde4c67366db97377e53d92e7b/c/pthread_main_np

an alternative fix would be to stop recycling the main thread
by simply leaking it. the leak is ok because, after all, it's
very rare for applications to continue after its main thread
exits. such applications don't even work as intended on some
of pthread implementations in the wild. for now, i'd go with
a more straightforward implementation though. ie. this commit.


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.114 -r1.115 src/lib/libpthread/pthread_int.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.