upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/process.cpp
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:10:44 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:10:44 -0500
commit6cedcbb015f12be06e5f063317a216e67ed28b76 (patch)
tree05d5a7129331f5c1deb19968ee532d3430eab9d7 /runtime/shims/process.cpp
parentd3184355a48b0123d135c30f1b18968300b4dbbb (diff)
parentb6299c9d825c9a03703a636f8205fb70c7028d60 (diff)
Merge pull request #4043 from AAyberkU
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/shims/process.cpp')
-rw-r--r--runtime/shims/process.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/shims/process.cpp b/runtime/shims/process.cpp
index 11464111e..77bcde936 100644
--- a/runtime/shims/process.cpp
+++ b/runtime/shims/process.cpp
@@ -80,13 +80,16 @@ std::string narrow(const std::wstring& w) {
80} 80}
81 81
82[[noreturn]] void end_run(int code) { 82[[noreturn]] void end_run(int code) {
83 // Read before signalling: once g_done is set, run_entry can return and clear g_running while the host is still
84 // finishing the run (main.cpp's "game exited" line and cleanup), which this thread must not cut short.
85 const bool running = g_running;
83 bool expected = false; 86 bool expected = false;
84 if (g_exited.compare_exchange_strong(expected, true)) { 87 if (g_exited.compare_exchange_strong(expected, true)) {
85 g_exit_code = code; 88 g_exit_code = code;
86 if (g_done) SetEvent(g_done); 89 if (g_done) SetEvent(g_done);
87 } 90 }
88 // Park until the host's ExitProcess, not ExitThread: Wine < 11.2 can exit 0 if the two race (4a9bc42a). 91 // Park until the host's ExitProcess, not ExitThread: Wine < 11.2 can exit 0 if the two race (4a9bc42a).
89 if (g_running) for (;;) Sleep(INFINITE); 92 if (running) for (;;) Sleep(INFINITE);
90 // The run is already over: this is game code running during host shutdown (an atexit handler the game 93 // The run is already over: this is game code running during host shutdown (an atexit handler the game
91 // registered with the shared CRT calling exit again). Finish the process with the game's exit code; ending 94 // registered with the shared CRT calling exit again). Finish the process with the game's exit code; ending
92 // just this thread here would make the host's last thread, and so the process, exit with `code` instead. 95 // just this thread here would make the host's last thread, and so the process, exit with `code` instead.