Files
ppsspp/Common/Thread/ParkingLot.cpp
T
libretroadmin 9f13f0f051 Remove sleeps and timed polling from the emulation and render paths
The core no longer sleeps to pace itself: the frontend runs retro_run at
its own rate, so the frame throttle, the idle-vblank delay and the real
clock sync event (and its core option) are gone, and a stepping CPU hands
straight back instead of waiting 2 ms. Waits that polled now park on a
lock-free eventcount through Common/Thread/ParkingLot and are woken by
whoever changes the state: a paused GL emu thread, which also queues a
marker behind its last frame so pausing runs the render queue up to it
instead of polling; async I/O results; the software renderer when its
queue is full; Vulkan pipeline compiles; and debugger requests once
stepping ends. Boot joins the loader thread, cache shutdown joins its
read-ahead thread, and the slow-I/O simulation is removed.

The path browser, the HTTP and WebSocket servers, the Windows console and
the game info cache are left out of the core build. libretro/test gains
lrgltest, which drives the GL backend on a surfaceless EGL context through
every path that pauses or stops the emu thread; run.sh and the image
checks CI job run it on llvmpipe.
2026-10-08 17:58:42 +02:00

34 lines
752 B
C++

#include "Common/Thread/ParkingLot.h"
static constexpr int PARKING_SHARDS = 64;
namespace {
struct ParkingLotShards {
retro_eventcount_t ec[PARKING_SHARDS];
ParkingLotShards() {
for (int i = 0; i < PARKING_SHARDS; i++)
retro_eventcount_init(&ec[i]);
}
~ParkingLotShards() {
for (int i = 0; i < PARKING_SHARDS; i++)
retro_eventcount_free(&ec[i]);
}
};
// Function-local so it exists before any static constructor that might wait.
ParkingLotShards &Shards() {
static ParkingLotShards shards;
return shards;
}
} // namespace
retro_eventcount_t *ParkingLotFor(const void *addr) {
uintptr_t h = (uintptr_t)addr;
h ^= h >> 17;
h *= (uintptr_t)0x9E3779B97F4A7C15ULL;
h ^= h >> 29;
return &Shards().ec[h & (PARKING_SHARDS - 1)];
}