Skip to documentation
SLOP

alloc_observe.install

Reference alloc_observe install

Internal implementation documentation

Defined in alloc_observe.

Installs a borrowed sink and context as the active observation target, returning an active session handle.

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

Source

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

zig
/// Installs a borrowed sink and context as the active observation target,/// returning an active session handle. If an enabled sink is already installed,/// the function returns AlreadyInstalled. In disabled builds, installation/// succeeds inertly. The caller must guarantee that sink storage and context/// pointers remain valid and stationary, because registered producers on other/// threads may deliver callbacks before install returns. The function must be/// called outside existing callbacks and suppression scopes. Callers must/// serialize session lifecycles externally, ensuring that prior session/// teardown completes fully before a new session is installed.pub fn install(sink: *const Sink) error{AlreadyInstalled}!Session {    if (comptime !enabled) {        return .{};    }    std.debug.assert(callback_depth == 0);    lockProducerRegistry();    defer producer_registry_lock.unlock();    const address = @intFromPtr(sink);    std.debug.assert(address != 0);    const producer_id_floor = next_producer_id.load(.acquire);    if (active_sink.cmpxchgStrong(        0,        address,        .acq_rel,        .acquire,    ) != null) {        return error.AlreadyInstalled;    }    return .{        .sink = sink,        .active = true,        .producer_id_floor = producer_id_floor,    };}

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

zig
/// Installs a borrowed sink and context as the active observation target,/// returning an active session handle. If an enabled sink is already installed,/// the function returns AlreadyInstalled. In disabled builds, installation/// succeeds inertly. The caller must guarantee that sink storage and context/// pointers remain valid and stationary, because registered producers on other/// threads may deliver callbacks before install returns. The function must be/// called outside existing callbacks and suppression scopes. Callers must/// serialize session lifecycles externally, ensuring that prior session/// teardown completes fully before a new session is installed.pub const install = protocol.install;

Audit

Definitions1
Public names1
Members0
Version26.7.0
Revisiondaab053ee433