From 1fe6b2aa4158516f9c6cf5751cc68aafef1af620 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 10 Sep 2019 13:08:26 +0200 Subject: Make the thread pool queue backlog user configurable Signed-off-by: David Oberhollenzer --- include/data_writer.h | 2 +- include/sqfs/block_processor.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/data_writer.h b/include/data_writer.h index 4d86bbf..9e82d11 100644 --- a/include/data_writer.h +++ b/include/data_writer.h @@ -37,7 +37,7 @@ enum { */ data_writer_t *data_writer_create(sqfs_super_t *super, sqfs_compressor_t *cmp, sqfs_file_t *file, size_t devblksize, - unsigned int num_jobs); + unsigned int num_jobs, size_t max_backlog); void data_writer_destroy(data_writer_t *data); diff --git a/include/sqfs/block_processor.h b/include/sqfs/block_processor.h index ed38be6..1032a35 100644 --- a/include/sqfs/block_processor.h +++ b/include/sqfs/block_processor.h @@ -161,6 +161,9 @@ extern "C" { * the deep copy function of the compressor is used to create * several instances that don't interfere with each other. * @param num_workers The number of worker threads to create. + * @param max_backlog The maximum number of blocks currently in flight. When + * trying to add more, enqueueing blocks until the in-flight + * block count drops below the threshold. * @param user An arbitrary user pointer to pass to the block callback. * @param callback A function to call for each finished data block. * @@ -172,6 +175,7 @@ SQFS_API sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size, sqfs_compressor_t *cmp, unsigned int num_workers, + size_t max_backlog, void *user, sqfs_block_cb callback); -- cgit v1.2.3