summaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor/winpthread.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-05-29 20:08:33 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-05-29 20:10:16 +0200
commitefb6ab552c5cdc9d12585c7c24b98667e212cb4c (patch)
treeab3ea9e3a22d8e4111cbc7b99ee99c6b6dae32f9 /lib/sqfs/block_processor/winpthread.c
parentbe6c0820313401f92f272db96f66053bdaa15320 (diff)
Block processor: merge finish & sync functions
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/block_processor/winpthread.c')
-rw-r--r--lib/sqfs/block_processor/winpthread.c43
1 files changed, 6 insertions, 37 deletions
diff --git a/lib/sqfs/block_processor/winpthread.c b/lib/sqfs/block_processor/winpthread.c
index afd66c1..e39f795 100644
--- a/lib/sqfs/block_processor/winpthread.c
+++ b/lib/sqfs/block_processor/winpthread.c
@@ -363,6 +363,11 @@ static int append_to_work_queue(sqfs_block_processor_t *proc,
return status;
}
+static int block_processor_sync(sqfs_block_processor_t *proc)
+{
+ return append_to_work_queue(proc, NULL);
+}
+
static thread_pool_processor_t *block_processor_create(size_t max_block_size,
sqfs_compressor_t *cmp,
unsigned int num_workers,
@@ -386,6 +391,7 @@ static thread_pool_processor_t *block_processor_create(size_t max_block_size,
return NULL;
}
+ proc->base.sync = block_processor_sync;
proc->base.append_to_work_queue = append_to_work_queue;
proc->num_workers = num_workers;
proc->max_backlog = max_backlog;
@@ -411,43 +417,6 @@ fail:
return NULL;
}
-int sqfs_block_processor_sync(sqfs_block_processor_t *proc)
-{
- return append_to_work_queue(proc, NULL);
-}
-
-int sqfs_block_processor_finish(sqfs_block_processor_t *proc)
-{
- thread_pool_processor_t *thproc = (thread_pool_processor_t *)proc;
- sqfs_block_t *blk;
- int status;
-
- status = sqfs_block_processor_sync(proc);
-
- if (status == 0 && proc->frag_block != NULL) {
- blk = proc->frag_block;
- blk->next = NULL;
- proc->frag_block = NULL;
-
- status = proc->process_block(blk, proc->cmp,
- thproc->workers[0]->scratch,
- proc->max_block_size);
-
- if (status == 0)
- status = handle_io_queue(thproc, blk);
-
- if (status != 0) {
- LOCK(&thproc->mtx);
- if (thproc->status == 0)
- thproc->status = status;
- SIGNAL_ALL(&thproc->queue_cond);
- UNLOCK(&thproc->mtx);
- }
- }
-
- return status;
-}
-
#if defined(_WIN32) || defined(__WINDOWS__)
sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size,
sqfs_compressor_t *cmp,