PriorityHouseQueue
A priority-aware MPSC house queue with two sub-queues: high-priority and normal-priority.
'''Dequeue order:''' high-priority sub-queue is always drained before the normal sub-queue (strict priority). This guarantees that actors that can immediately push the system forward (reply/event backlogs, or no downstream blocking — see ActorHouse._highPriority) are always served before normal actors.
'''Priority is determined at enqueue time.''' The ActorHouse._highPriority cached flag is read once when the house enters the queue (via ActorHouse.waitingToReady → HouseManager.ready → enqueue). A house that becomes high-priority while already queued will be correctly prioritized on its next enqueue (after ActorHouse.completeRunning re-evaluates the flag).
'''Concurrency model:''' SpinLock-based MPSC. Multiple producer threads can enqueue concurrently; the owning ActorThread dequeues via dequeue. Other threads may attempt opportunistic steals via stealDequeue, which uses SpinLock.tryLock to avoid spinning on the owner's lock. Each sub-queue has independent read/write lock pairs to avoid cross-priority contention.
'''Schedule() outside lock:''' the READY → SCHEDULED CAS in ActorHouse.schedule is performed after releasing the queue lock. This is safe because no other thread can change the house state between unlock and schedule: the house is in READY state, removed from the queue, and no lifecycle transition is possible until schedule() fires.
Attributes
- Graph
-
- Supertypes