From 892066b0477186801d290953a9b994df353f8dbb Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 14 Feb 2020 15:54:39 +0100 Subject: Cleanup: block processor: move finish function back into implementations The "generic" version actually uses specific internals of the thread pool implementation. Move it back into the thread pool based implementation and simplify the serial processor. Signed-off-by: David Oberhollenzer --- lib/sqfs/block_processor/winpthread.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lib/sqfs/block_processor/winpthread.c') diff --git a/lib/sqfs/block_processor/winpthread.c b/lib/sqfs/block_processor/winpthread.c index ca07718..708a2d1 100644 --- a/lib/sqfs/block_processor/winpthread.c +++ b/lib/sqfs/block_processor/winpthread.c @@ -446,3 +446,28 @@ int wait_completed(sqfs_block_processor_t *proc) } return status; } + +int sqfs_block_processor_finish(sqfs_block_processor_t *proc) +{ + int status = 0; + + append_to_work_queue(proc, NULL); + + while (proc->backlog > 0) { + status = wait_completed(proc); + if (status) + return status; + } + + if (proc->frag_block != NULL) { + status = append_to_work_queue(proc, proc->frag_block); + proc->frag_block = NULL; + + if (status) + return status; + + status = wait_completed(proc); + } + + return status; +} -- cgit v1.2.3