AnyPS5/core/libs/prx/libkernel/Pthread/src
DotDebian 4dea441f01
fix(libkernel): do not expose stale thread-specific values through a reused pthread key
scePthreadKeyDelete frees a key slot and the next scePthreadKeyCreate
hands the same index out again, but every thread kept the value it had
stored under that index. The new key read the previous key's value
instead of NULL, and at thread exit its destructor was called on that
stale pointer.

Each slot now carries a sequence number, as in FreeBSD libthr. A thread
value is visible to scePthreadGetspecific and to the exit destructors
only while its sequence matches the slot's, so a new key starts as NULL
in every thread, as POSIX requires, and a deleted key reads NULL.

scePthreadGetspecific stays lock-free and scePthreadSetspecific no
longer takes the key lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 00:26:20 +00:00
..
Attr.cpp fix(libkernel): report the thread's priority and affinity from scePthreadAttrGet 2026-10-02 18:03:51 +02:00
Cond.cpp perf(libkernel): resolve initialised mutexes and conditions without the global lock 2026-09-27 11:26:59 -07:00
Mutex.cpp fix(libkernel): default mutexes to error checking and add the adaptive type 2026-10-04 14:28:33 +02:00
Rwlock.cpp feat(libkernel): implement the pthread_rwlock try and timed lock functions 2026-10-04 17:13:36 +02:00
Sem.cpp feat(kernel): implement pthread semaphore lifecycle 2026-09-29 22:13:07 +00:00
Thread.cpp Merge pull request #171 from asimplestray/feat/kernel-time-signal 2026-09-30 21:03:48 +03:00
Tsd.cpp fix(libkernel): do not expose stale thread-specific values through a reused pthread key 2026-10-05 00:26:20 +00:00