mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 10:59:16 -04:00
6451508633
autocompile_request() returned 0 on every non-Windows host, so a Linux or macOS player never had a shard compiled at runtime: captures were written, the packager staged a working toolchain, the boot log said "overlay autocompile enabled", and every overlay ran interpreted for the whole session (Parasite Eve on Rocky 9: 1.35e9 interpreted instructions by frame 13k with /usr/bin/gcc beside the exe). Mirror the Windows spawner with fork/exec: /bin/sh -c runs the configured command in its own process group at nice 10, stdout+stderr flow through one pipe into the same tail ring (streaming PSX_SHARD_RESULT parse), a pthread watcher drains the pipe and reaps the child, and the emulation thread's poll turns DONE into the one idempotent cache rescan. No PSX_SHARD_PUBLISHED handoff off Windows: the rescan is the fallback the Windows path already takes when a marker is cut off. Shutdown SIGTERMs the group and joins; PR_SET_PDEATHSIG on Linux plus the dying pipe cover a runtime that never reaches shutdown. The PSX_OVERLAY_* pins are set once at configure time (glibc setenv is not safe against a concurrent getenv). Configure names the interpreter it will run and marks the run degraded when the path is not executable. Link Threads unconditionally on Unix. The child-line buffer, shard_result_values, shard_result_line_locked and publish_parse_locked move out of the Windows block; child_line_locked is per-platform. Both Windows unit tests still pass. Verified on Rocky 9 (PE diagnostic product): 0 -> 68 shards in 150 s, interpreted instructions by frame 14.5k 1.35e9 -> 0.39e9, curve flat from frame ~4k, counters visible over the debug server, quit and SIGKILL mid-compile leave no orphans or zombies. (cherry picked from commit 854540c9c96e86b0cc1eea0dd99ef285169784d9)