benilla-re systems structs docs

AcquireSlot

function · core · orchestration

Address
0x421080 · 336 bytes, up to 0x4211cf
Signature
uint32_t __cdecl (void)
Meaning
Returns the slot index a loop thread serves, building a slot when the entry is empty
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.

Callers 2

Callees 8

Calls and jumps by a bare address, from tables/calls.tsv.