const Ctx = struct {
some_data: u32,
};
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
const ctx = Ctx{ .some_data = 42 };
var server = try Server(Ctx).init(ctx, allocator);
server.set_handler(my_handler_function, 1);
_ = try server.execute_all();
_ = server.deinit();
}
fn my_handler_function(ctx: Ctx) anyerror!void {
std.debug.print("some_data: {d}\n", .{ctx.some_data});
std.time.sleep(std.time.ns_per_s * 0.6);
}
-
Notifications
You must be signed in to change notification settings - Fork 0
wizard-lgtm/zig-threading
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
threading implementations and examples in ziglang
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published