alloc_observe.beginContext
Internal implementation documentation
Defined in alloc_observe.
Reserves an operation identifier and establishes thread nesting without publishing an event when finished.
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
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |