Struct async_spin_sleep::Builder
source · pub struct Builder {
pub schedule_resolution: Duration,
pub gc_threshold: usize,
pub channel_capacity: Option<usize>,
/* private fields */
}Fields§
§schedule_resolution: DurationDefault scheduling resolution for this driver. Setting this to a lower value may decrease CPU usage of the driver, but may also dangerously increase the chance of missing a wakeup event due to the OS scheduler.
gc_threshold: usizeAborted nodes that are too far from execution may remain in the driver’s memory for a long time. This value specifies the maximum number of aborted nodes that can be stored in the driver’s memory. If this value is exceeded, the driver will collect garbage.
channel_capacity: Option<usize>Set channel capacity. This value is used to initialize the channel that connects the driver and its handles. If the channel is full, the driver will block until the channel is available.
When None is specified, an unbounded channel will be used.
Implementations§
source§impl Builder
impl Builder
sourcepub fn with_schedule_resolution(self, value: Duration) -> Self
pub fn with_schedule_resolution(self, value: Duration) -> Self
Sets the schedule_resolution field of this struct.
sourcepub fn with_gc_threshold(self, value: usize) -> Self
pub fn with_gc_threshold(self, value: usize) -> Self
Sets the gc_threshold field of this struct.
sourcepub fn with_channel_capacity(self, value: impl Into<Option<usize>>) -> Self
pub fn with_channel_capacity(self, value: impl Into<Option<usize>>) -> Self
Sets the channel_capacity field of this struct.