Files
RetroArch/frontend/drivers
libretroadmin 93f47ac416 platform_unix: route JNI thread-local storage through rthreads
The Android JNI glue in frontend/drivers/platform_unix.c held the
per-thread JNIEnv* in a raw pthread_key_t, created with
pthread_key_create(..., jni_thread_destruct) so the JVM is detached when a
thread exits, and updated with pthread_setspecific().

rthreads already wraps TLS (sthread_tls_*), but sthread_tls_create()
passes a NULL destructor, so it could not preserve the detach-on-exit
behaviour. Add sthread_tls_create_with_dtor(), which forwards a
pthread_key_create() destructor on pthread backends (Win32 TlsAlloc has no
destructor callback and ignores it -- documented; current users are
POSIX). Route the driver through it plus sthread_tls_set(), change
thread_key to sthread_tls_t, and drop <pthread.h> for
<rthreads/rthreads.h>.

The destructor (jni_thread_destruct) is preserved, so JVM detach on thread
teardown is unchanged. platform_unix.c no longer makes direct pthread
calls. No functional change on Android.
2026-07-16 01:47:55 +02:00
..
2020-06-30 08:37:41 +02:00