aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/executor.h
diff options
context:
space:
mode:
authorZhao Zhili <zhilizhao@tencent.com>2024-06-24 12:47:43 +0800
committerNuo Mi <nuomi2021@gmail.com>2024-06-27 20:54:42 +0800
commitbaf3123c1c849f7fb909d96c8ad0b1ead2bc4128 (patch)
treeca7a305cbca3e1678d15f5216e2ad38afa870092 /libavutil/executor.h
parentd79c926ab6282f225de8d1a39a5234ebc4d38451 (diff)
downloadffmpeg-baf3123c1c849f7fb909d96c8ad0b1ead2bc4128.tar.gz
avutil/executor: Allowing thread_count be zero
Before the patch, disable threads support at configure/build time was the only method to force zero thread in executor. However, it's common practice for libavcodec to run on caller's thread when user specify thread number to one. And for WASM environment, whether threads are supported needs to be detected at runtime. So executor should support zero thread at runtime. A single thread executor can be useful, e.g., to handle network protocol. So we can't take thread_count one as zero thread, which disabled a valid usercase. Other libraries take -threads 0 to mean auto. Executor as a low level utils doesn't do cpu detect. So take thread_count zero as zero thread, literally. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Diffstat (limited to 'libavutil/executor.h')
-rw-r--r--libavutil/executor.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavutil/executor.h b/libavutil/executor.h
index c602bcb613..0eb21c10c8 100644
--- a/libavutil/executor.h
+++ b/libavutil/executor.h
@@ -46,7 +46,7 @@ typedef struct AVTaskCallbacks {
/**
* Alloc executor
* @param callbacks callback structure for executor
- * @param thread_count worker thread number
+ * @param thread_count worker thread number, 0 for run on caller's thread directly
* @return return the executor
*/
AVExecutor* av_executor_alloc(const AVTaskCallbacks *callbacks, int thread_count);