VLC
4.0.0-dev
|
Data Structures | |
struct | task |
struct | background_thread |
struct | background_worker |
Functions | |
static struct task * | task_Create (struct background_worker *worker, void *id, void *entity, int timeout) |
static void | task_Destroy (struct background_worker *worker, struct task *task) |
static struct task * | QueueTake (struct background_worker *worker, int timeout_ms) |
static void | QueuePush (struct background_worker *worker, struct task *task) |
static void | QueueRemoveAll (struct background_worker *worker, void *id) |
static struct background_thread * | background_thread_Create (struct background_worker *owner) |
static void | background_thread_Destroy (struct background_thread *thread) |
static struct background_worker * | background_worker_Create (void *owner, struct background_worker_config *conf) |
static void | background_worker_Destroy (struct background_worker *worker) |
static void | TerminateTask (struct background_thread *thread, struct task *task) |
static void | RemoveThread (struct background_thread *thread) |
static void * | Thread (void *data) |
static bool | SpawnThread (struct background_worker *worker) |
struct background_worker * | background_worker_New (void *owner, struct background_worker_config *conf) |
Create a background-worker. More... | |
int | background_worker_Push (struct background_worker *worker, void *entity, void *id, int timeout) |
Push an entity into the background-worker. More... | |
static void | BackgroundWorkerCancelLocked (struct background_worker *worker, void *id) |
void | background_worker_Cancel (struct background_worker *worker, void *id) |
Remove entities from the background-worker. More... | |
void | background_worker_RequestProbe (struct background_worker *worker) |
Request the background-worker to probe the current task. More... | |
void | background_worker_Delete (struct background_worker *worker) |
Delete a background-worker. More... | |
|
static |
References background_thread::cancel, background_thread::owner, background_thread::probe, background_thread::probe_cancel_wait, background_thread::task, thread, and vlc_cond_init().
Referenced by SpawnThread().
|
static |
Referenced by RemoveThread().
void background_worker_Cancel | ( | struct background_worker * | worker, |
void * | id | ||
) |
Remove entities from the background-worker.
This function is used to remove processing of a certain entity given its associated id, or to remove all queued (including currently running) entities.
id
passed refers to an entity that is currently being processed, the call will block until the task has been terminated.worker | the background-worker |
id | NULL if every entity shall be removed, and the currently running task (if any) shall be cancelled. |
References BackgroundWorkerCancelLocked(), background_worker::lock, vlc_mutex_lock(), and vlc_mutex_unlock().
Referenced by input_preparser_Cancel(), input_preparser_Deactivate(), and vlc_thumbnailer_Cancel().
|
static |
References background_worker::closing, background_worker::conf, background_worker::lock, background_worker::nothreads_wait, background_worker::nthreads, background_worker::owner, background_worker::queue, background_worker::queue_wait, background_worker::threads, background_worker::uncompleted, unlikely, vlc_cond_init(), vlc_list_init(), and vlc_mutex_init().
Referenced by background_worker_New().
void background_worker_Delete | ( | struct background_worker * | worker | ) |
Delete a background-worker.
This function will destroy a background-worker created through background_worker_New. It will effectively stop the currently running task, if any, and empty the queue of pending entities.
worker | the background-worker |
References background_worker_Destroy(), BackgroundWorkerCancelLocked(), background_worker::closing, background_worker::lock, background_worker::nothreads_wait, background_worker::nthreads, background_worker::queue_wait, vlc_cond_broadcast(), vlc_cond_wait(), vlc_mutex_lock(), and vlc_mutex_unlock().
Referenced by input_fetcher_Delete(), input_fetcher_New(), input_preparser_Delete(), and vlc_thumbnailer_Release().
|
static |
Referenced by background_worker_Delete().
struct background_worker* background_worker_New | ( | void * | owner, |
struct background_worker_config * | config | ||
) |
Create a background-worker.
This function creates a new background-worker using the passed configuration.
config
shall have been set by the caller. owner | the owner of the background-worker |
config | the background-worker's configuration |
NULL
on failure. References background_worker_Create().
Referenced by input_preparser_New(), vlc_thumbnailer_Create(), and WorkerInit().
int background_worker_Push | ( | struct background_worker * | worker, |
void * | entity, | ||
void * | id, | ||
int | timeout | ||
) |
Push an entity into the background-worker.
This function is used to push an entity into the queue of pending work. The entities will be processed in the order in which they are received (in terms of the order of invocations in a single-threaded environment).
worker | the background-worker |
entity | the entity which is to be queued |
id | a value suitable for identifying the entity, or NULL |
timeout | the timeout of the entity in milliseconds, 0 denotes no timeout, a negative value will use the default timeout associated with the background-worker. |
References background_worker::conf, background_worker::lock, background_worker_config::max_threads, background_worker::nthreads, QueuePush(), SpawnThread(), task_Create(), background_worker::uncompleted, unlikely, VLC_ENOMEM, vlc_mutex_lock(), vlc_mutex_unlock(), and VLC_SUCCESS.
Referenced by input_fetcher_Push(), input_preparser_Push(), SearchByScope(), SearchLocal(), and thumbnailer_RequestCommon().
void background_worker_RequestProbe | ( | struct background_worker * | worker | ) |
Request the background-worker to probe the current task.
This function is used to signal the background-worker that it should do another probe to see whether the current task is still alive.
worker | the background-worker |
References background_worker::lock, background_thread::probe, background_thread::probe_cancel_wait, thread, background_worker::threads, vlc_cond_signal(), vlc_list_foreach, vlc_mutex_lock(), and vlc_mutex_unlock().
Referenced by FetcherThread(), on_thumbnailer_input_event(), and OnParserEnded().
|
static |
References background_thread::cancel, task::id, background_worker::lock, background_thread::probe_cancel_wait, QueueRemoveAll(), background_thread::task, thread, background_worker::threads, vlc_cond_signal(), vlc_list_foreach, and vlc_mutex_assert.
Referenced by background_worker_Cancel(), and background_worker_Delete().
|
static |
References background_worker::lock, task::node, background_worker::queue, background_worker::queue_wait, vlc_cond_signal(), vlc_list_append(), and vlc_mutex_assert.
Referenced by background_worker_Push().
|
static |
References task::id, background_worker::lock, task::node, background_worker::queue, task_Destroy(), vlc_list_foreach, vlc_list_remove(), and vlc_mutex_assert.
Referenced by BackgroundWorkerCancelLocked().
|
static |
References background_worker::closing, background_worker::lock, task::node, background_worker::queue, background_worker::queue_wait, task::timeout, vlc_cond_timedwait(), vlc_list_first_entry_or_null, vlc_list_is_empty(), vlc_list_remove(), vlc_mutex_assert, VLC_TICK_FROM_MS, and vlc_tick_now().
Referenced by Thread().
|
static |
|
static |
|
static |
References background_worker::conf, background_worker_config::default_timeout, task::entity, task::id, background_worker_config::pf_hold, task::timeout, unlikely, and VLC_TICK_FROM_MS.
Referenced by background_worker_Push().
|
static |
References background_worker::conf, task::entity, and background_worker_config::pf_release.
Referenced by QueueRemoveAll(), and TerminateTask().
|
static |
References background_worker::lock, background_thread::owner, background_thread::task, task_Destroy(), background_worker::uncompleted, vlc_mutex_lock(), and vlc_mutex_unlock().
Referenced by Thread().
|
static |
References background_thread::cancel, background_worker::conf, task::entity, background_worker::lock, background_thread::owner, background_worker::owner, background_worker_config::pf_probe, background_worker_config::pf_start, background_worker_config::pf_stop, background_thread::probe, background_thread::probe_cancel_wait, QueueTake(), RemoveThread(), background_thread::task, TerminateTask(), thread, task::timeout, vlc_cond_timedwait(), vlc_mutex_lock(), vlc_mutex_unlock(), and vlc_tick_now().
Referenced by SpawnThread().