pub struct DispatcherBuilder { /* private fields */ }
Expand description
A builder for Dispatcher
s
Implementations§
Source§impl DispatcherBuilder
impl DispatcherBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new DispatcherBuilder
that can be used to configure a new dispatcher.
For more information on the threading-related flags for the dispatcher, see
https://fuchsia.dev/fuchsia-src/concepts/drivers/driver-dispatcher-and-threads
Sourcepub fn unsynchronized(self) -> Self
pub fn unsynchronized(self) -> Self
Sets whether parallel callbacks in the callbacks set in the dispatcher are allowed. May
not be set with Self::allow_thread_blocking
.
See https://fuchsia.dev/fuchsia-src/concepts/drivers/driver-dispatcher-and-threads for more information on the threading model of driver dispatchers.
Sourcepub fn is_unsynchronized(&self) -> bool
pub fn is_unsynchronized(&self) -> bool
Whether or not this is an unsynchronized dispatcher
Sourcepub fn allow_thread_blocking(self) -> Self
pub fn allow_thread_blocking(self) -> Self
This dispatcher may not share zircon threads with other drivers. May not be set with
Self::unsynchronized
.
See https://fuchsia.dev/fuchsia-src/concepts/drivers/driver-dispatcher-and-threads for more information on the threading model of driver dispatchers.
pub fn allows_thread_blocking(&self) -> bool
Sourcepub fn name(self, name: &str) -> Self
pub fn name(self, name: &str) -> Self
A descriptive name for this dispatcher that is used in debug output and process lists.
Sourcepub fn scheduler_role(self, role: &str) -> Self
pub fn scheduler_role(self, role: &str) -> Self
A hint string for the runtime that may or may not impact the priority the work scheduled by this dispatcher is handled at. It may or may not impact the ability for other drivers to share zircon threads with the dispatcher.
Sourcepub fn shutdown_observer<F: ShutdownObserverFn>(
self,
shutdown_observer: F,
) -> Self
pub fn shutdown_observer<F: ShutdownObserverFn>( self, shutdown_observer: F, ) -> Self
A callback to be called before after the dispatcher has completed asynchronous shutdown.
Sourcepub fn create(self) -> Result<Dispatcher, Status>
pub fn create(self) -> Result<Dispatcher, Status>
Create the dispatcher as configured by this object. This must be called from a
thread managed by the driver runtime. The dispatcher returned is owned by the caller,
and will initiate asynchronous shutdown when the object is dropped unless
Dispatcher::release
is called on it to convert it into an unowned DispatcherRef
.
Sourcepub fn create_released(self) -> Result<DispatcherRef<'static>, Status>
pub fn create_released(self) -> Result<DispatcherRef<'static>, Status>
As with Self::create
, this creates a new dispatcher as configured by this object, but
instead of returning an owned reference it immediately releases the reference to be
managed by the driver runtime.