pub struct Schedule<'a, P> { /* private fields */ }Expand description
Host feature providing data to build a ScheduleHandler.
Implementations§
Source§impl<'a, P: Worker> Schedule<'a, P>
impl<'a, P: Worker> Schedule<'a, P>
Sourcepub fn schedule_work(
&self,
worker_data: P::WorkData,
) -> Result<(), ScheduleError<P::WorkData>>
pub fn schedule_work( &self, worker_data: P::WorkData, ) -> Result<(), ScheduleError<P::WorkData>>
Request the host to call the worker thread.
If this method fails, the data is considered as untransmitted and is returned to the caller.
This method should be called from run() context to request that the host call the work()
method in a non-realtime context with the given arguments.
This function is always safe to call from run(), but it is not guaranteed that the worker
is actually called from a different thread. In particular, when free-wheeling (e.g. for
offline rendering), the worker may be executed immediately. This allows single-threaded
processing with sample accuracy and avoids timing problems when run() is executing much
faster or slower than real-time.
Plugins SHOULD be written in such a way that if the worker runs immediately, and responses from the worker are delivered immediately, the effect of the work takes place immediately with sample accuracy.
Notes about the passed data: The buffer used to pass data is managed by the host. That mean the size is unknown and may be limited. So if you need to pass huge amount of data, it’s preferable to use another way, for example a sync::mpsc channel.