AnyPS5/core/libs/prx/libkernel/Pthread/include
Nicolas Abosch 3acca27f27 feat(libkernel): implement thread cancellation
scePthreadCancel and pthread_cancel threw, scePthreadTestcancel did
nothing and the cleanup handler exports did not exist.

A cancel request is now recorded on the thread and acted on at
scePthreadTestcancel, the condition variable waits, scePthreadSem and
sem waits, scePthreadJoin and the sleeps, and under their POSIX names.
A thread blocked in one of the waits is woken; a condition wait takes
its mutex back before the thread exits. The thread exits with
PTHREAD_CANCELED through scePthreadExit, which now runs the handlers
of __pthread_cleanup_push_imp and __pthread_cleanup_pop_imp.
scePthreadSetcancelstate and scePthreadSetcanceltype reject unknown
values, and pthread_setcanceltype is added.

Constants, the handler node layout and the order of events follow
FreeBSD libthr. A sleep is not interrupted, file and socket calls are
not cancellation points and the asynchronous type acts like the
deferred one except at the two set calls (TechnicalDebt). New test:
guest_pthread_cancel.
2026-10-10 11:32:09 +02:00
..
Cancel.hpp feat(libkernel): implement thread cancellation 2026-10-10 11:32:09 +02:00
Cond.hpp feat(libkernel): impl pthread condition variables + posix thread attribute queries 2026-09-27 11:43:37 +03:00
Mutex.hpp feat(libkernel): implement posix mutex locking and timed waits 2026-09-27 11:43:37 +03:00
Pthread.hpp feat(libkernel): implement thread cancellation 2026-10-10 11:32:09 +02:00
Rwlock.hpp feat(libkernel): implement the pthread_rwlock try and timed lock functions 2026-10-04 17:13:36 +02:00
ThreadLifecycle.hpp feat(libkernel): implement application heap and thread atexit registration 2026-09-27 11:43:33 +03:00
WindowsThreadLocal.hpp fix(libkernel): keep Unity GC delivery out of MinGW TLS waits 2026-10-10 03:06:40 +03:00