mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
17 lines
532 B
Zig
17 lines
532 B
Zig
const std = @import("std");
|
|
|
|
pub const AutoreleasePool = opaque {
|
|
pub inline fn init() *AutoreleasePool {
|
|
return @ptrCast(*AutoreleasePool, objc_autoreleasePoolPush().?);
|
|
}
|
|
|
|
pub inline fn deinit(self: *AutoreleasePool) void {
|
|
objc_autoreleasePoolPop(self);
|
|
}
|
|
};
|
|
|
|
// I'm not sure if these are internal or not... they aren't in any headers,
|
|
// but its how autorelease pools are implemented.
|
|
extern "c" fn objc_autoreleasePoolPush() ?*anyopaque;
|
|
extern "c" fn objc_autoreleasePoolPop(?*anyopaque) void;
|