benilla-re systems structs docs

s_slotLocks

global · core

Address
0x883f14 · 4 bytes, up to 0x883f17
Type
void *
Meaning
Holds the array of one critical section per slot, its count stored before it
Confidence
verified, proof one
Finding
core/scheduler#slot-acquire-and-release

Finding: Slot acquire and release in core: scheduler

AcquireSlot (0x421080) returns the index of the slot a loop thread serves. Under the slot lock 0x883ef4 it takes the first empty table entry, else the entry with the fewest threads (+0x0c, the lowest index on a tie). An empty entry gets a new slot: an auto-reset event, initially unset, at +0x20, an empty heap with element offset 0x30, and the last place in the slot list. The thread count rises by 1. ReleaseSlot (0x4211d0) lowers it. At 0 it clears the table entry, empties the heap, frees the slot, then sets the run state of each removed context to 1 when it is 0 and tears it down with 0x420e60 on the calling thread, the last one removed first.

The derivation is in the doc.