Files
bun.sh/src/bun.js/webcore/ScriptExecutionContext.zig
Jarred Sumner ba5d2e4b6c Revert "Try mimalloc v3 (#17378)"
This reverts commit 93f92658b3.
2025-08-01 14:59:56 -07:00

21 lines
865 B
Zig

extern fn ScriptExecutionContextIdentifier__getGlobalObject(id: u32) ?*bun.jsc.JSGlobalObject;
/// Safe handle to a JavaScript execution environment that may have exited.
/// Obtain with global_object.scriptExecutionContextIdentifier()
pub const Identifier = enum(u32) {
_,
/// Returns null if the context referred to by `self` no longer exists
pub fn globalObject(self: Identifier) ?*bun.jsc.JSGlobalObject {
return ScriptExecutionContextIdentifier__getGlobalObject(@intFromEnum(self));
}
/// Returns null if the context referred to by `self` no longer exists
pub fn bunVM(self: Identifier) ?*bun.jsc.VirtualMachine {
// concurrently because we expect these identifiers are mostly used by off-thread tasks
return (self.globalObject() orelse return null).bunVMConcurrently();
}
};
const bun = @import("bun");