pub struct InterruptManager { /* private fields */ }Expand description
Central interrupt manager coordinating interrupt observations and waiters.
Implementations§
Source§impl InterruptManager
impl InterruptManager
pub fn new() -> Self
Sourcepub fn register(&mut self, resource: ResourceId)
pub fn register(&mut self, resource: ResourceId)
Registers an offered interrupt resource.
Sourcepub fn is_registered(&self, resource: ResourceId) -> bool
pub fn is_registered(&self, resource: ResourceId) -> bool
Checks if a resource is registered.
Sourcepub fn on_interrupt(
&mut self,
resource: ResourceId,
timestamp_ns: i64,
backend: Option<&mut dyn InterruptBackend>,
) -> Result<InterruptEvent, Denial>
pub fn on_interrupt( &mut self, resource: ResourceId, timestamp_ns: i64, backend: Option<&mut dyn InterruptBackend>, ) -> Result<InterruptEvent, Denial>
Triggers an interrupt event on resource.
Increments sequence and count, updates timestamp, calculates coalesced count, satisfies all eligible waiters, and invokes their callbacks (Spec 17).
Sourcepub fn wait_for_interrupt(
&mut self,
resource: ResourceId,
after_sequence: u64,
sender: Box<dyn FnOnce(InterruptEvent) + Send>,
) -> Result<Option<InterruptEvent>, Denial>
pub fn wait_for_interrupt( &mut self, resource: ResourceId, after_sequence: u64, sender: Box<dyn FnOnce(InterruptEvent) + Send>, ) -> Result<Option<InterruptEvent>, Denial>
Requests an interrupt observation.
If state.sequence > after_sequence, returns Ok(Some(event)) immediately.
Otherwise, registers the callback to be notified when the next event arrives.
Sourcepub fn cancel_waiters(&mut self)
pub fn cancel_waiters(&mut self)
Clears all pending waiters (for example during session close or PrepareStop).
Sourcepub fn waiter_count(&self, resource: ResourceId) -> usize
pub fn waiter_count(&self, resource: ResourceId) -> usize
Number of active waiters for a given resource.
Trait Implementations§
Source§impl Debug for InterruptManager
impl Debug for InterruptManager
Auto Trait Implementations§
impl !RefUnwindSafe for InterruptManager
impl !Sync for InterruptManager
impl !UnwindSafe for InterruptManager
impl Freeze for InterruptManager
impl Send for InterruptManager
impl Unpin for InterruptManager
impl UnsafeUnpin for InterruptManager
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