Trait gstreamer::subclass::prelude::TaskPoolImpl

source ·
pub trait TaskPoolImpl: GstObjectImpl + Send + Sync {
    type Handle: TaskHandle;

    // Required method
    fn push(
        &self,
        func: TaskPoolFunction,
    ) -> Result<Option<Self::Handle>, Error>;

    // Provided methods
    fn prepare(&self) -> Result<(), Error> { ... }
    fn cleanup(&self) { ... }
}

Required Associated Types§

source

type Handle: TaskHandle

Handle to be returned from the push function to allow the caller to wait for the task’s completion.

If unneeded, you can specify () or Infallible for a handle that does nothing on join or drop.

Required Methods§

source

fn push(&self, func: TaskPoolFunction) -> Result<Option<Self::Handle>, Error>

Deliver a task to the pool.

If returning Ok, you need to call the func eventually.

If returning Err, the func must be dropped without calling it. Start the execution of a new thread from self.

§func

the function to call

§Returns

a pointer that should be used for the gst_task_pool_join function. This pointer can be None, you must check error to detect errors. If the pointer is not None and gst_task_pool_join() is not used, call gst_task_pool_dispose_handle() instead.

Provided Methods§

source

fn prepare(&self) -> Result<(), Error>

Prepare the task pool to accept tasks.

This defaults to doing nothing. Prepare the taskpool for accepting TaskPoolExtManual::push() operations.

MT safe.

source

fn cleanup(&self)

Clean up, rejecting further tasks and waiting for all accepted tasks to be stopped.

This is mainly used internally to ensure proper cleanup of internal data structures in test suites. Wait for all tasks to be stopped. This is mainly used internally to ensure proper cleanup of internal data structures in test suites.

MT safe.

Object Safety§

This trait is not object safe.

Implementors§