Skip to content

fiberCount

ffredyk edited this page Jul 23, 2026 · 1 revision

fiberCount

Category

Scheduler Management

Arity

UnaryfiberCount <schedulerId>.

fiberCount <number>

Description

Returns the total number of fibers (ready + waiting) on the given scheduler. Includes fibers that are currently sleeping, awaiting handles, or ready to execute.

How It Works

Counts all fibers registered with the scheduler — both in the ready queue and the waiting (sleep/await) list.

Usage

_total = fiberCount 1;         // e.g., 42
systemChat f"Total fibers on Main: {_total}";

Monitor scheduler load

_total = fiberCount _schedulerId;
_ready = readyFiberCount _schedulerId;
_waiting = waitingFiberCount _schedulerId;
systemChat f"Fibers: {_total} total, {_ready} ready, {_waiting} waiting";

Health check

if (fiberCount 1 > 1000) then {
    systemChat "Warning: High fiber count on Main";
};

Thread Safety

ReadOnly — approximate snapshot. Fiber count may change between the call and subsequent operations. Safe from any scheduler.

See Also

SQ# Wiki

Home

Engine Docs

Migration

Commands

Value Constructors

Arithmetic

Comparison

Logic

Array

String

Math

Random

Type & Introspection

HashMap

Code Execution

Concurrency

Scheduler

Thread Safety

Error

Output

Time

Multiplayer

Compiler

Clone this wiki locally