pub trait TaskExt: IsA<Task> + Sealed + 'static {
// Provided methods
fn pool(&self) -> TaskPool { ... }
fn state(&self) -> TaskState { ... }
fn join(&self) -> Result<(), BoolError> { ... }
fn pause(&self) -> Result<(), BoolError> { ... }
fn resume(&self) -> Result<(), BoolError> { ... }
fn set_pool(&self, pool: &impl IsA<TaskPool>) { ... }
fn set_state(&self, state: TaskState) -> Result<(), BoolError> { ... }
fn start(&self) -> Result<(), BoolError> { ... }
fn stop(&self) -> Result<(), BoolError> { ... }
}
Provided Methods§
sourcefn join(&self) -> Result<(), BoolError>
fn join(&self) -> Result<(), BoolError>
Joins self
. After this call, it is safe to unref the task
and clean up the lock set with [TaskExtManual::set_lock()
][crate::prelude::TaskExtManual::set_lock()].
The task will automatically be stopped with this call.
This function cannot be called from within a task function as this would cause a deadlock. The function will detect this and print a g_warning.
§Returns
true
if the task could be joined.
MT safe.
sourcefn set_state(&self, state: TaskState) -> Result<(), BoolError>
fn set_state(&self, state: TaskState) -> Result<(), BoolError>
Sets the state of self
to state
.
The self
must have a lock associated with it using
[TaskExtManual::set_lock()
][crate::prelude::TaskExtManual::set_lock()] when going to GST_TASK_STARTED or GST_TASK_PAUSED or
this function will return false
.
MT safe.
§state
the new task state
§Returns
true
if the state could be changed.
Object Safety§
This trait is not object safe.