aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/executor.c
diff options
context:
space:
mode:
authorNuo Mi <nuomi2021@gmail.com>2024-09-24 22:16:57 +0800
committerNuo Mi <nuomi2021@gmail.com>2024-10-04 21:58:42 +0800
commit40a14ef970f7210c64ccfc5625871ef577f3e3a3 (patch)
treedff8a86c9dcef84c906a139403ee91a3335f2305 /libavcodec/executor.c
parent8446e27bf3b6d9be9dd151399d6739d8e1e910d4 (diff)
downloadffmpeg-40a14ef970f7210c64ccfc5625871ef577f3e3a3.tar.gz
avcodec/executor: remove unused ready callback
Due to the nature of multithreading, using a "ready check" mechanism may introduce a deadlock. For example: Suppose all tasks have been submitted to the executor, and the last thread checks the entire list and finds no ready tasks. It then goes to sleep, waiting for a new task. However, for some multithreading-related reason, a task becomes ready after the check. Since no other thread is aware of this and no new tasks are being added to the executor, a deadlock occurs. In VVC, this function is unnecessary because we use a scoreboard. All tasks submitted to the executor are ready tasks.
Diffstat (limited to 'libavcodec/executor.c')
-rw-r--r--libavcodec/executor.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/executor.c b/libavcodec/executor.c
index 574c5c7be7..21ebad3def 100644
--- a/libavcodec/executor.c
+++ b/libavcodec/executor.c
@@ -79,10 +79,8 @@ static void add_task(FFTask **prev, FFTask *t)
static int run_one_task(FFExecutor *e, void *lc)
{
FFTaskCallbacks *cb = &e->cb;
- FFTask **prev;
+ FFTask **prev = &e->tasks;
- for (prev = &e->tasks; *prev && !cb->ready(*prev, cb->user_data); prev = &(*prev)->next)
- /* nothing */;
if (*prev) {
FFTask *t = remove_task(prev, *prev);
if (e->thread_count > 0)
@@ -143,7 +141,7 @@ FFExecutor* ff_executor_alloc(const FFTaskCallbacks *cb, int thread_count)
{
FFExecutor *e;
int has_lock = 0, has_cond = 0;
- if (!cb || !cb->user_data || !cb->ready || !cb->run || !cb->priority_higher)
+ if (!cb || !cb->user_data || !cb->run || !cb->priority_higher)
return NULL;
e = av_mallocz(sizeof(*e));