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.

Provided Methods§

source

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

Prepare the task pool to accept tasks.

This defaults to doing nothing.

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.

Object Safety§

This trait is not object safe.

Implementors§