mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 06:09:58 -04:00
Gather the log lines of a quarter of a second and write them at once.
The log thread wrote as soon as it woke, which outside a burst is once for every line: each line woke it and was a write of its own to the log file and the console. It now waits a quarter of a second from the first line it finds, or until the queue is half full, and writes what was queued by then at once, so the log is up to that much behind the game. What is being gathered stays in the queue, so a fatal error, a crash report and an exit write it out before their own lines as before; a game ended from outside loses those last lines. The queue's test checks the gathering, the half-full write and that a process which ends at once, by an exit or as a fatal error does, leaves every line in its file. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -41,10 +41,11 @@ from other projects, with its license, is listed in [THIRD_PARTY_NOTICES.md](../
|
||||
variables and written back when the in-game menu changes it. The menu and the performance overlay are Dear ImGui,
|
||||
drawn into the swapchain image (`runtime/ui/`); their text is in `ui_text.c`.
|
||||
- Log: in a game run the lines go through a queue to a thread that writes them (`runtime/logq.c`), so a stalled
|
||||
write to the log file or the console does not hold the thread that logged. A thread's lines reach the log in the
|
||||
order it logged them: a line waits for the queue's lock, and one that finds the queue full is written after
|
||||
everything queued before it. A fatal error, the crash report and the end of the process write the queue out first
|
||||
(`rt_log_sync`). `NX2NAVI_LOG_ASYNC=0` writes each line where it is logged.
|
||||
write to the log file or the console does not hold the thread that logged. The log thread gathers the lines of
|
||||
a quarter of a second, or half a queue, into one write, so the log is up to that much behind the game. A thread's
|
||||
lines reach the log in the order it logged them: a line waits for the queue's lock, and one that finds the queue
|
||||
full is written after everything queued before it. A fatal error, the crash report and the end of the process write
|
||||
the queue out first (`rt_log_sync`). `NX2NAVI_LOG_ASYNC=0` writes each line where it is logged.
|
||||
- Co-op (`coop.c`, `coop_proto.c`, [coop.md](coop.md)): a host thread with a UDP socket to a relay (`tools/coop_relay.py`),
|
||||
rooms of up to 8 players and a channel for messages between them; it never holds a virtual core.
|
||||
- OS calls the host makes go through `runtime/platform/` (`platform.h`, `win32.c`).
|
||||
|
||||
Reference in New Issue
Block a user