mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-03 13:35:26 +01:00
b58ab43bea
The black box recorder wrote its file on the main thread: the records went into a 256 kB file buffer and the flush after each look (once a simulated second) wrote them to the disk. On a busy disk that write can hold the frame up. The new blackbox::file_output keeps what the writer puts in its stream in memory, and hand_over() passes it to a thread that writes and flushes it, in the order it was put in. close() hands over the rest and waits for the thread, so the file is whole when the recording ends, as before. The bytes of the file are the same: the writer and its records aren't touched, only where they go. Unit tests for the order of the parts, the rest written at close, and nothing written while closed.