pub trait TaskExt: IsA<Task> + '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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.