zig updates

This commit is contained in:
Luna 2024-10-23 21:53:50 -03:00
parent 605b9347a4
commit 9f1eb7e0e0

View file

@ -31,7 +31,7 @@ const Context = struct {
pub fn createNode(self: *Self, data: []const u8) !*BufferQueue.Node {
var queue_node = try self.frame_allocator.create(BufferQueue.Node);
var node_data = try self.frame_allocator.dupe(u8, data);
const node_data = try self.frame_allocator.dupe(u8, data);
queue_node.data = node_data;
return queue_node;
}
@ -106,6 +106,7 @@ fn senderThread(ctx: *Context) !void {
while (true) {
const node = (ctx.frames.get()) orelse {
// if no incoming frames, wait
logger.info("no frames", .{});
std.time.sleep(100 * std.time.ns_per_ms);
continue;
};
@ -120,7 +121,7 @@ fn senderThread(ctx: *Context) !void {
);
}
std.time.sleep(375);
std.time.sleep(1000 * std.time.ns_per_us);
}
}
@ -153,7 +154,7 @@ pub fn main() !void {
var to_sock = try network.Socket.create(.ipv4, .udp);
defer to_sock.close();
var queue = BufferQueue.init();
const queue = BufferQueue.init();
var ctx = Context{
.frame_allocator = allocator,
.frames = queue,