Struct swap::worker::BackgroundJobControl
source · pub struct BackgroundJobControl {
event: Event,
abort_flag: AtomicBool,
}
Expand description
The event channel for background jobs.
This sends an abort request from the main thread to the job thread via atomic boolean flag.
This notifies the main thread that the job thread is completed via [Event].
Fields§
§event: Event
§abort_flag: AtomicBool
Implementations§
source§impl BackgroundJobControl
impl BackgroundJobControl
sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates BackgroundJobControl.
sourcepub fn new_job(&self) -> BackgroundJob<'_>
pub fn new_job(&self) -> BackgroundJob<'_>
Creates BackgroundJob.
sourcepub fn reset(&self) -> Result<bool>
pub fn reset(&self) -> Result<bool>
Reset the internal state for a next job.
Returns false, if the event is already reset and no event exists.
sourcepub fn get_completion_event(&self) -> &Event
pub fn get_completion_event(&self) -> &Event
Returns the event to notify the completion of background job.
Auto Trait Implementations§
impl RefUnwindSafe for BackgroundJobControl
impl Send for BackgroundJobControl
impl Sync for BackgroundJobControl
impl Unpin for BackgroundJobControl
impl UnwindSafe for BackgroundJobControl
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more