have a background function that runs on a separate thread. At startup, this function atomically sets a flag that disables flushes during a rewrite. Instead, all data is written to a buffer and then merged at the end of the rewrite.
I’d like to write tests for this multithreaded scenario. Specifically, I need to detect the exact moment the code sets the flag, verify that it’s active, and then continue execution. During that process, I plan to append data to the AOF buffer and expect the rewrite algorithm to correctly merge it at the end.
Does this testing approach make sense, or would you recommend a different strategy?
For synchronization, I initially tried using std.Thread.ResetEvent, but encountered a Bus error at address 0x100e24b0c.