Commit Graph
26 Commits
Author SHA1 Message Date
libretroadmin f1208a7a5a Make threading lock-free
The core and the headless tools no longer use mutexes, condition variables,
spinlocks, std::atomic, std::thread or volatile flags. Threads hand off through
libretro-common's retro_atomic and rthreads plus a few small pieces on top of
them in Common/Thread: Thread, MpscQueue, EventCounter, ParkingLot waits and
ReaderGate. Every wait blocks until it's woken; nothing polls on a timer.

State that only one thread touches just loses its lock. The PSP filesystem,
sceIo and the savedata dialog now belong to the emulation thread: async reads
and writes run when they're queued and complete later in emulated time, and
the IO and savedata threads are gone. The friend finder only talks to the
adhoc server and hands what it gets to the emulation thread. GPU init always
runs on the thread that starts the game.

The Vulkan render and compile queues, pipeline and render pass caches, delete
list and SPIR-V cache, the GL render queue, the software renderer's jit caches,
the file loader caches, the web debugger, UPnP, input, savestates, logging and
the GE debugger all hand off through queues and atomics. The IR jit's spinning
profiler thread goes.

A CPU thread with nothing to run now sleeps until work is queued instead of
spinning. Headless with --debugger waits for a client while stopped, and ends
the run once every client that connected has left. Web server shutdown keeps
servicing the CPU queue until the server has finished.
2026-10-09 04:56:16 +02:00
libretroadmin f0b97a2e90 Remove the standalone frontends
The libretro core is the frontend, and the headless tools are the test and
debugging hosts. The Windows, UWP, Android, iOS, macOS and SDL apps, the UI
framework and imgui go, along with what only they used: the Win32 debugger
hooks (g_frameMutex, the shutdown lock), JNI thread attachment, the Android
text drawer, RAIntegration, Discord, recent files, game installs, tilt input,
the audio resamplers, the control mapper, memstick moving and the remote ISO
and upload server modes. The web server keeps the debugger. The MSVC, Gradle
and ndk-build projects go too.
2026-10-09 04:56:10 +02:00
Henrik Rydgård 93638c8826 Test fix 2025-08-24 15:46:35 +02:00
Henrik Rydgård f6050a442c Fix serving the remote debugger locally, add a setting for the auto-launcher 2025-08-24 11:17:19 +02:00
Henrik Rydgård acad90a041 More work on the lua console 2025-03-27 14:26:48 +01:00
Henrik Rydgård e5d00ce493 Fix startup on Android, oops
Forgot that we can't create android-compatible threads in global
constructors, for JNI reasons.
2025-03-27 01:58:53 +01:00
oltolm 9566065455 make compile on mingw-w64 2025-01-11 01:25:27 +01:00
Henrik Rydgård 080798b5dd Move out two more functions from Core.cpp. Clean up Windows includes 2024-12-08 12:12:02 +01:00
Henrik Rydgård e01ca5b057 Logging API change (refactor) (#19324)
* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
2024-07-14 14:42:59 +02:00
Henrik Rydgård ab6fafb6eb Invert dependency to avoid compile issues 2023-01-05 08:38:53 +01:00
Henrik Rydgård b56eef487c Strict mode checking - no way to forget detaching now.
And if we forget to attach, boom. Hopefully I caught all of them.
2023-01-05 08:38:52 +01:00
Henrik Rydgård 916404f0e4 Try to get a bit better at detaching threads that have used JNI from the VM. 2023-01-05 08:38:49 +01:00
Unknown W. Brackets e21f2b8fcf Common: UWP buildfix.
Just use SetThreadDescription() directly, assuming new enough Windows.
2021-11-13 09:40:07 -08:00
Henrik Rydgård 9f1c9b9963 Buildfix 2021-11-13 18:12:09 +01:00
Henrik Rydgård 6e1455fd55 Use the "new" API SetThreadDescription to set thread names on Windows.
Mainly useful in debugging and profiling tools. Using the new function helps
modern debugging/profiling tools like Superluminal which don't support the
old exception method.

(Is there any old tool left that might be a reason we'd want to do both?)
2021-11-13 18:02:36 +01:00
Unknown W. Brackets 3ac669f80b Core: Fix some minor gcc warnings. 2021-09-13 08:13:14 -07:00
Jan Beich ae39923223 Thread: set names on BSDs after 062566b67c 2021-08-10 16:44:44 +00:00
Jan Beich 5b7557acd4 Thread: unbreak on BSDs after 50d9d7ea6f
Common/Thread/ThreadUtil.cpp:149:2: error: use of undeclared identifier 'pthread_threadid_np'
        pthread_threadid_np(NULL, &tid);
        ^
2021-08-10 16:44:41 +00:00
Henrik Rydgård 15a2373f04 Implement thread debug id with the syscall instead of gettid().
See #14545
2021-06-21 01:27:17 +02:00
Henrik Rydgård 692a54ea74 An attempt at cleaning up the checks in ThreadUtil 2021-06-19 14:54:36 +02:00
Henrik Rydgård c92775d26b Try a slightly rougher fix for libretro builds
(our builds work, but not their CI)
2021-06-14 22:44:27 +02:00
Henrik Rydgård 727b84ce5e Possible fix for reported problem with gettid() in libretro 2021-06-14 18:07:24 +02:00
Henrik Rydgård 50d9d7ea6f Unittest buildfixes on mac 2021-06-12 22:42:10 +02:00
Henrik Rydgård 0fa27ff9d7 Autodetect number of threads (remove setting). Fix some bugs. 2021-06-12 21:06:59 +02:00
Henrik Rydgård f4a6d291e1 Common: Capitalize setCurrentThreadName(). 2021-04-30 23:02:36 -07:00
Henrik Rydgård 15382d5f94 Move threading utils from native to Common 2020-10-01 09:27:25 +02:00