Semaphore¶
Import: import system.core;
Semaphore¶
Counting semaphore for limiting concurrent access to a shared resource.
constructor¶
Creates a semaphore with initial available permits.
host_acquire¶
Waits until the synchronization object can be acquired.
host_release¶
Releases the synchronization object after acquisition.
host_try_acquire¶
Attempts acquisition without waiting; returns whether it succeeded.
host_try_acquire_for¶
Attempts acquisition for up to timeout_ms milliseconds.
acquire¶
Blocks (busy-waiting) until a permit is available, then takes one.
try_acquire¶
One-shot acquire: returns true if a permit was taken, false if none were available.
try_acquire_for¶
Waits up to timeout_ms milliseconds for a permit. timeout_ms <= 0 is a single try.
release¶
Returns one permit.