diff --git a/src/sys.zig b/src/sys.zig index e857989..8f86a17 100644 --- a/src/sys.zig +++ b/src/sys.zig @@ -54,7 +54,7 @@ pub const EventLoop = opaque { /// const Implementation = struct { user_prefix: []const u8, - file_system_semaphore: *ext.SDL_Semaphore, + file_system_semaphore: *ext.SDL_sem, file_system_thread: *ext.SDL_Thread, file_system_messages: ?*FileSystemMessage = null, @@ -495,13 +495,13 @@ pub fn runGraphics(comptime Errors: anytype, run: GraphicsRunner(Errors)) Errors var event_loop = EventLoop.Implementation{ .file_system_semaphore = ext.SDL_CreateSemaphore(0) orelse return error.InitFailure, - - .file_system_thread = ext.SDL_CreateThread(EventLoop.processFileSystemMessages, - "File System Worker", &event_loop) orelse return error.InitFailure, - + .file_system_thread = unreachable, .user_prefix = pref_path, }; + event_loop.file_system_thread = ext.SDL_CreateThread(EventLoop.processFileSystemMessages, + "File System Worker", &event_loop) orelse return error.InitFailure; + defer { ext.SDL_DestroyThread(event_loop.file_system_thread); ext.SDL_DestroySemaphore(event_loop.file_system_semaphore);