Skip to main content

QueuedGate

Struct QueuedGate 

Source
pub struct QueuedGate { /* private fields */ }
Expand description

Per-process “already queued this pass” flags (scheduler.md §4’s literal queued_this_pass bit, lifted out of any one process’s storage into its own gate so sensitivity_match_to_enqueue can dedup across every cell a process is sensitive to, not just one).

The flags are a Vec<AtomicBool> indexed by ProcessId behind an RwLock: both methods take &self and must create a flag on first touch (no registration step pre-populates them), which needs the write lock once per process; every later touch takes only the read lock, and the flag itself is flipped and reset by a genuine atomic swap/store (SC-056’s acceptance: “the AtomicBool must be real, not a Cell<bool>”), so QueuedGate stays Send + Sync with no lock needed around it. (It was a Mutex<HashMap<ProcessId, Arc<AtomicBool>>>, whose hash, lock and Arc clone on every match cost 3-5% of a fan-out-heavy run.)

Implementations§

Source§

impl QueuedGate

Source

pub fn new() -> Self

Source

pub fn mark_queued_if_not_already(&self, proc: ProcessId) -> bool

The exact if !process.queued_this_pass.swap(true, Ordering::AcqRel) { ... } idiom from scheduler.md §4: atomically marks proc as queued and returns true iff this call is the one that transitioned the flag from unqueued to queued — i.e. iff this call is the one that should push proc onto active_q. A second call for the same proc before the flag is reset returns false (SC-055’s “queued only once”).

Source

pub fn reset_on_dequeue(&self, proc: ProcessId)

Clears proc’s queued flag. Callers invoke this the instant a process is popped off the ready set to run, before resume() is called — never at enqueue time (SC-056) — so a legitimate re-trigger landing in the dequeue-to-re-registration gap is correctly seen as a fresh, unqueued state and re-queues the process rather than being silently swallowed.

Trait Implementations§

Source§

impl Default for QueuedGate

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V