summaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor/winpthread.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-13 23:51:13 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-15 18:09:40 +0100
commit81c47bee5b554688aaeaedc9d8453a676b9a9107 (patch)
treed66abe7b833ebc32e414abc445dce9838aa93c82 /lib/sqfs/block_processor/winpthread.c
parent5916e87394cc7e3d38102798def727ae233b9997 (diff)
Cleanup: block processor: remove test_and_set_status
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.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/sqfs/block_processor/winpthread.c b/lib/sqfs/block_processor/winpthread.c
index 6d7c843..ca07718 100644
--- a/lib/sqfs/block_processor/winpthread.c
+++ b/lib/sqfs/block_processor/winpthread.c
@@ -410,19 +410,6 @@ static int process_done_queue(sqfs_block_processor_t *proc, sqfs_block_t *queue)
return status;
}
-int test_and_set_status(sqfs_block_processor_t *proc, int status)
-{
- LOCK(&proc->mtx);
- if (proc->status == 0) {
- proc->status = status;
- } else {
- status = proc->status;
- }
- SIGNAL_ALL(&proc->queue_cond);
- UNLOCK(&proc->mtx);
- return status;
-}
-
int wait_completed(sqfs_block_processor_t *proc)
{
sqfs_block_t *queue;
@@ -446,5 +433,16 @@ int wait_completed(sqfs_block_processor_t *proc)
}
status = process_done_queue(proc, queue);
- return status ? test_and_set_status(proc, status) : status;
+
+ if (status != 0) {
+ LOCK(&proc->mtx);
+ if (proc->status == 0) {
+ proc->status = status;
+ } else {
+ status = proc->status;
+ }
+ SIGNAL_ALL(&proc->queue_cond);
+ UNLOCK(&proc->mtx);
+ }
+ return status;
}