napi_threadsafe_function

This commit is contained in:
Jarred Sumner
2022-05-05 03:20:03 -07:00
parent b487eb7e13
commit 30ca112260
2 changed files with 254 additions and 15 deletions

View File

@@ -480,11 +480,12 @@ pub const SavedSourceMap = struct {
const uws = @import("uws");
pub const AnyTask = struct {
ctx: *anyopaque,
ctx: ?*anyopaque,
callback: fn (*anyopaque) void,
pub fn run(this: *AnyTask) void {
this.callback(this.ctx);
@setRuntimeSafety(false);
this.callback(this.ctx.?);
}
pub fn New(comptime Type: type, comptime Callback: anytype) type {