From 3e20d948f8676c3fe7728d80dd9e3e64e89cdaee Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Mon, 27 Nov 2023 15:41:10 +0500 Subject: [PATCH] formatting --- src/threads.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/threads.zig b/src/threads.zig index 676e5ed..3c80c16 100644 --- a/src/threads.zig +++ b/src/threads.zig @@ -10,7 +10,7 @@ const Signals = struct { const Self = @This(); fn init() Self { - return Self { + return Self{ .quit = AtomicBool.init(false), }; } @@ -25,7 +25,7 @@ const QueueWrap = struct { fn init(alloc: std.mem.Allocator, job_pool: util.JobPool) !Self { var q = try alloc.create(util.JobQueue); q.* = util.JobQueue.init(job_pool); - return Self { + return Self{ .queue = q, .job_pool = job_pool, }; @@ -45,7 +45,7 @@ pub const ThreadManager = struct { var arena = std.heap.ArenaAllocator.init(alloc); var arena_alloc = arena.allocator(); var job_pool = util.JobPool.init(alloc); - var thread_mgr = Self { + var thread_mgr = Self{ .threads = std.ArrayList(std.Thread).init(arena_alloc), .arena = arena, .queue_wrp = try QueueWrap.init(arena_alloc, job_pool), @@ -55,9 +55,9 @@ pub const ThreadManager = struct { thread_mgr.signals.* = Signals.init(); for (0..n_quant_jobs) |_| { - try thread_mgr.threads.append(try std.Thread.spawn(.{}, quantize_loop, .{thread_mgr.queue_wrp.queue, thread_mgr.signals})); + try thread_mgr.threads.append(try std.Thread.spawn(.{}, quantize_loop, .{ thread_mgr.queue_wrp.queue, thread_mgr.signals })); } - + return thread_mgr; } @@ -70,6 +70,6 @@ pub const ThreadManager = struct { fn quantize_loop(queue: *util.JobQueue, signals: *Signals) void { while (queue.HasJobs() or !signals.quit.load(std.builtin.AtomicOrder.Acquire)) : (std.time.sleep(1)) { const job = queue.pop() orelse continue; - std.debug.print("{any}\n", .{job}); + std.debug.print("{any}\n", .{job.source.*}); } }