PriorityHouseQueue

cc.otavia.core.system.PriorityHouseQueue
class PriorityHouseQueue(manager: HouseManager) extends HouseQueue

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.waitingToReadyHouseManager.readyenqueue). 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
class HouseQueue
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def available: Boolean
override def dequeue(): ActorHouse | Null

Attributes

Definition Classes
override def enqueue(house: ActorHouse): Unit

Attributes

Definition Classes
override def isEmpty: Boolean

Attributes

Definition Classes
override def nonEmpty: Boolean

Attributes

Definition Classes
def readies: Int
def stealDequeue(): ActorHouse | Null

Opportunistic dequeue for cross-thread stealing. Uses SpinLock.tryLock() instead of SpinLock.lock() to avoid the stealing thread spinning on the owning thread's lock. Returns null immediately if the lock is contended.

Opportunistic dequeue for cross-thread stealing. Uses SpinLock.tryLock() instead of SpinLock.lock() to avoid the stealing thread spinning on the owning thread's lock. Returns null immediately if the lock is contended.

Only handles the size > 1 case. When size == 1, the dequeue path requires acquiring both readLock and writeLock (to null out the tail pointer). Skipping this case is acceptable because the steal threshold (64+) guarantees the queue is deep when stealing is attempted.

Attributes

Inherited methods

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
HouseQueue -> Any
Inherited from:
HouseQueue