diff options
| author | Mike7581 <168859477+Mike7581@users.noreply.github.com> | 2026-11-25 16:05:59 -0300 |
|---|---|---|
| committer | Mike7581 <168859477+Mike7581@users.noreply.github.com> | 2026-11-27 16:10:51 -0300 |
| commit | 1dd08900f6a5f646e90fa317b8e75cda4eee788f (patch) | |
| tree | 2bb2a2dd15e7cb99da77a617b348489c133a7759 /docs/github-metadata-export.md | |
| parent | 6f7963abddd7e545f43097c50f687e8e71626d72 (diff) | |
process: the run's cleanup holds one lock, as the UCRT's exit lock; a throwing handler terminates
Review follow-up for #1564:
- Registration and the cleanup of exit, quick_exit and _cexit hold one recursive lock of the run's own, from before the thread-local callback through the table's drain (and _cexit's stream flush), as the UCRT holds its exit lock: two threads never clean up at once, and a registration from another thread waits for the cleanup. The exiting thread may still register from a handler, _cexit still returns, and the lock is released before the run ends (end_run), also when a handler ends the run from inside a drain.
- Each guest cleanup callback (atexit, at_quick_exit, the thread-local destructor callback) runs inside a C++ exception boundary: one that throws ends the run through game_abort, as the UCRT's terminate() would (exit code 3), instead of leaving the process with 0xE06D7363.
tiny_atexit gains four modes, held to the native sequence: concurrent_cexit (a second thread's _cexit, with a thread_local of its own, waits for the cleanup), quick_exit_register (an at_quick_exit from a second thread during a quick_exit drain waits, so its handler never runs), quick_exit_throw and exit_throw (exit code 3). In the concurrent modes the slow handler waits until the second thread is about to call, so the sequence is fixed under any scheduling with the lock. All four fail on c5b51e9 through --run.
Diffstat (limited to 'docs/github-metadata-export.md')
0 files changed, 0 insertions, 0 deletions