diff --git a/src/threads.zig b/src/threads.zig index 3c80c16..b3490d1 100644 --- a/src/threads.zig +++ b/src/threads.zig @@ -1,17 +1,21 @@ const std = @import("std"); const util = @import("util.zig"); +const transform = @import("transform.zig"); const AtomicBool = std.atomic.Atomic(bool); +const AtomicU32 = std.atomic.Atomic(u32); const Signals = struct { quit: AtomicBool, + processed: AtomicU32, const Self = @This(); fn init() Self { return Self{ .quit = AtomicBool.init(false), + .processed = AtomicU32.init(0), }; } }; @@ -70,6 +74,7 @@ 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.source.*}); + transform.quantize(job.source, job.target); + _ = @atomicRmw(u32, &signals.processed.value, .Add, 1, .SeqCst); } }