Commit: 0108209fee408f801e89a41e6cc88f31d7aef040
Parent: bc3d47016040d28aada1425abd2998afd983a185
Author: Randy Palamar
Date: Tue, 20 Jan 2026 10:14:13 -0700
w32: make sure file watches on a single frame share a timestamp
Because the dispatch_file_watch() may get called more than once
per frame on w32 we still need to be careful and pass in the
timestamp directly.
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/main_w32.c b/main_w32.c
@@ -297,13 +297,11 @@ load_platform_libraries(BeamformerInput *input)
}
function void
-dispatch_file_watch(BeamformerInput *input, Arena arena, OSW32_FileWatchDirectory *fw_dir)
+dispatch_file_watch(BeamformerInput *input, Arena arena, u64 current_time, OSW32_FileWatchDirectory *fw_dir)
{
TempArena save_point = {0};
i64 offset = 0;
- u64 current_time = os_timer_count();
-
w32_file_notify_info *fni = (w32_file_notify_info *)fw_dir->buffer;
do {
end_temp_arena(save_point);
@@ -357,12 +355,15 @@ clear_io_queue(BeamformerInput *input, Arena arena)
w32_overlapped *overlapped;
u32 bytes_read;
uptr user_data;
+
+ u64 current_time = os_timer_count();
+
while (GetQueuedCompletionStatus(handle, &bytes_read, &user_data, &overlapped, 0)) {
w32_io_completion_event *event = (w32_io_completion_event *)user_data;
switch (event->tag) {
case W32IOEvent_FileWatch:{
OSW32_FileWatchDirectory *dir = (OSW32_FileWatchDirectory *)event->context;
- dispatch_file_watch(input, arena, dir);
+ dispatch_file_watch(input, arena, current_time, dir);
zero_struct(&dir->overlapped);
ReadDirectoryChangesW(dir->handle, dir->buffer, OSW32_FileWatchDirectoryBufferSize, 0,
FILE_NOTIFY_CHANGE_LAST_WRITE, 0, &dir->overlapped, 0);