use pointer to thread_mgr instead for thread control funcs for loop
This commit is contained in:
parent
1182082c50
commit
4abd5b9019
2 changed files with 5 additions and 2 deletions
|
@ -58,9 +58,12 @@ fn read_chrom(f: std.fs.File, source_buff: [][]util.Block, target_buff: [][]util
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main_loop(f: std.fs.File, buffs: util.Buffers, thread_mgr: threads.ThreadManager) !void {
|
pub fn main_loop(f: std.fs.File, buffs: util.Buffers, thread_mgr: *threads.ThreadManager) !void {
|
||||||
|
thread_mgr.unblock();
|
||||||
try read_lum(f, buffs.Y, buffs.Y_quant, buffs.input_buff, thread_mgr.queue_wrp.queue);
|
try read_lum(f, buffs.Y, buffs.Y_quant, buffs.input_buff, thread_mgr.queue_wrp.queue);
|
||||||
try read_chrom(f, buffs.U, buffs.U_quant, buffs.input_buff[0 .. buffs.input_buff.len / 2], thread_mgr.queue_wrp.queue);
|
try read_chrom(f, buffs.U, buffs.U_quant, buffs.input_buff[0 .. buffs.input_buff.len / 2], thread_mgr.queue_wrp.queue);
|
||||||
try read_chrom(f, buffs.V, buffs.V_quant, buffs.input_buff[0 .. buffs.input_buff.len / 2], thread_mgr.queue_wrp.queue);
|
try read_chrom(f, buffs.V, buffs.V_quant, buffs.input_buff[0 .. buffs.input_buff.len / 2], thread_mgr.queue_wrp.queue);
|
||||||
while (thread_mgr.signals.processed.load(.Acquire) != buffs.num_blocks) : (std.time.sleep(1)) {}
|
while (thread_mgr.signals.processed.load(.Acquire) != buffs.num_blocks) : (std.time.sleep(1)) {}
|
||||||
|
thread_mgr.eof();
|
||||||
|
thread_mgr.quit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,5 +65,5 @@ pub fn main() !void {
|
||||||
defer thread_manager.deinit();
|
defer thread_manager.deinit();
|
||||||
|
|
||||||
var f = std.io.getStdIn();
|
var f = std.io.getStdIn();
|
||||||
try input.main_loop(f, buffs, thread_manager);
|
try input.main_loop(f, buffs, &thread_manager);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue