vlc | branch: master | Rémi Denis-Courmont <r...@remlab.net> | Wed Sep 19 06:15:57 2018 +0300| [7dfdce94e9c3dfb4979d61a33d95ac65630fcf22] | committer: Rémi Denis-Courmont
Revert "background_worker: store the timeout in vlc_tick_t" This reverts commit 703ffde2cdbac363021499c6778b38888a0d0101. This broke the testsuite. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7dfdce94e9c3dfb4979d61a33d95ac65630fcf22 --- src/misc/background_worker.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/misc/background_worker.c b/src/misc/background_worker.c index be8f61888a..822da04cb5 100644 --- a/src/misc/background_worker.c +++ b/src/misc/background_worker.c @@ -33,7 +33,7 @@ struct task { struct vlc_list node; void* id; /**< id associated with entity */ void* entity; /**< the entity to process */ - vlc_tick_t timeout; /**< timeout duration in milliseconds */ + int timeout; /**< timeout duration in milliseconds */ }; struct background_worker; @@ -73,7 +73,7 @@ static struct task *task_Create(struct background_worker *worker, void *id, task->id = id; task->entity = entity; - task->timeout = timeout < 0 ? worker->conf.default_timeout : VLC_TICK_FROM_MS(timeout); + task->timeout = timeout < 0 ? worker->conf.default_timeout : timeout; worker->conf.pf_hold(task->entity); return task; } @@ -84,17 +84,17 @@ static void task_Destroy(struct background_worker *worker, struct task *task) free(task); } -static struct task *QueueTake(struct background_worker *worker, vlc_tick_t timeout) +static struct task *QueueTake(struct background_worker *worker, int timeout_ms) { vlc_assert_locked(&worker->lock); - vlc_tick_t deadline = vlc_tick_now() + timeout; - bool has_timeout = false; - while (!has_timeout && !worker->closing && vlc_list_is_empty(&worker->queue)) - has_timeout = vlc_cond_timedwait(&worker->queue_wait, + vlc_tick_t deadline = vlc_tick_now() + VLC_TICK_FROM_MS(timeout_ms); + bool timeout = false; + while (!timeout && !worker->closing && vlc_list_is_empty(&worker->queue)) + timeout = vlc_cond_timedwait(&worker->queue_wait, &worker->lock, deadline) != 0; - if (worker->closing || has_timeout) + if (worker->closing || timeout) return NULL; struct task *task = vlc_list_first_entry_or_null(&worker->queue, @@ -212,7 +212,7 @@ static void* Thread( void* data ) for (;;) { vlc_mutex_lock(&worker->lock); - struct task *task = QueueTake(worker, VLC_TICK_FROM_SEC(5)); + struct task *task = QueueTake(worker, 5000); if (!task) { vlc_mutex_unlock(&worker->lock); _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits