Skip to documentation
SLOP

alloc_observe.beginContext

Reference alloc_observe beginContext

Internal implementation documentation

Defined in alloc_observe.

Reserves an operation identifier and establishes thread nesting without publishing an event when finished.

Called byCallsNo direct callersprivate sourcelib.alloc.observe.src.protocolinactiveContextprivate sourcelib.alloc.observe.src.protocoltakeIdalloc_observebeginContext
Static calls · unresolved targets: 0 · external targets: 3.

Source

Source: lib/alloc/observe/src/protocol.zig:694

zig
/// Reserves an operation identifier and establishes thread nesting without/// publishing an event when finished. In enabled builds with an installed sink/// and no active suppression, the context increments the active operation count/// and links into the thread parent stack. In all other circumstances, it/// returns an inert token with an identifier of zero. Callers must finish the/// returned context on its originating thread, as active contexts contribute to/// the session drain count during shutdown.pub inline fn beginContext() Context {    if (comptime !enabled) return .{};    if (callback_depth != 0) return inactiveContext();    _ = active_operations.fetchAdd(1, .acquire);    if (active_sink.load(.acquire) == 0) {        _ = active_operations.fetchSub(1, .release);        return inactiveContext();    }    const operation_id = takeId(&next_operation_id);    const parent_operation_id = current_operation_id;    current_operation_id = operation_id;    return .{        .operation_id = operation_id,        .parent_operation_id = parent_operation_id,    };}

Source: lib/alloc/observe/src/root.zig:461

zig
/// Reserves an operation identifier and establishes thread nesting without/// publishing an event when finished. In enabled builds with an installed sink/// and no active suppression, the context increments the active operation count/// and links into the thread parent stack. In all other circumstances, it/// returns an inert token with an identifier of zero. Callers must finish the/// returned context on its originating thread, as active contexts contribute to/// the session drain count during shutdown.pub const beginContext = protocol.beginContext;

Audit

Definitions1
Public names1
Members0
Version26.7.0
Revisiondaab053ee433