diff options
-rw-r--r-- | include/sqfs/block_processor.h | 17 | ||||
-rw-r--r-- | lib/sqfs/block_processor/serial.c | 5 | ||||
-rw-r--r-- | lib/sqfs/block_processor/winpthread.c | 5 |
3 files changed, 27 insertions, 0 deletions
diff --git a/include/sqfs/block_processor.h b/include/sqfs/block_processor.h index cef4459..6945633 100644 --- a/include/sqfs/block_processor.h +++ b/include/sqfs/block_processor.h @@ -198,11 +198,28 @@ SQFS_API int sqfs_block_processor_append(sqfs_block_processor_t *proc, SQFS_API int sqfs_block_processor_end_file(sqfs_block_processor_t *proc); /** + * @brief Wait for the in-flight data blocks to finish. + * + * @memberof sqfs_block_processor_t + * + * @param proc A pointer to a block processor object. + * + * @return Zero on success, an @ref E_SQFS_ERROR value on failure. The failure + * return value can either be an error encountered during enqueueing, + * processing or writing to disk. + */ +SQFS_API int sqfs_block_processor_sync(sqfs_block_processor_t *proc); + +/** * @brief Wait for the in-flight data blocks to finish and finally flush the * current fragment block. * * @memberof sqfs_block_processor_t * + * This does essentially the same as @ref sqfs_block_processor_sync, but after + * syncing, it also flushes the current fragment block, even if it isn't full + * yet and waits for it to be completed as well. + * * @param proc A pointer to a block processor object. * * @return Zero on success, an @ref E_SQFS_ERROR value on failure. The failure diff --git a/lib/sqfs/block_processor/serial.c b/lib/sqfs/block_processor/serial.c index 2e00198..b797ca0 100644 --- a/lib/sqfs/block_processor/serial.c +++ b/lib/sqfs/block_processor/serial.c @@ -81,6 +81,11 @@ done: return sproc->status; } +int sqfs_block_processor_sync(sqfs_block_processor_t *proc) +{ + return ((serial_block_processor_t *)proc)->status; +} + int sqfs_block_processor_finish(sqfs_block_processor_t *proc) { serial_block_processor_t *sproc = (serial_block_processor_t *)proc; diff --git a/lib/sqfs/block_processor/winpthread.c b/lib/sqfs/block_processor/winpthread.c index 492ad6e..47408a7 100644 --- a/lib/sqfs/block_processor/winpthread.c +++ b/lib/sqfs/block_processor/winpthread.c @@ -523,6 +523,11 @@ int append_to_work_queue(sqfs_block_processor_t *proc, sqfs_block_t *block) return status; } +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; |