pkg/libuv: fix stage2 compilation issues

This commit is contained in:
Mitchell Hashimoto
2022-10-14 09:44:22 -07:00
parent 2d3febac0e
commit b28b04d710
2 changed files with 12 additions and 6 deletions

View File

@ -24,12 +24,16 @@ cond: Cond,
ready: bool = false,
terminate: BoolAtomic,
sleeping: BoolAtomic,
callback: fn () void,
callback: std.meta.FnPtr(fn () void),
thread: ?Thread,
/// Initialize a new embedder. The callback is called when libuv should
/// tick. The callback should be as fast as possible.
pub fn init(alloc: Allocator, loop: Loop, callback: fn () void) !Embed {
pub fn init(
alloc: Allocator,
loop: Loop,
callback: std.meta.FnPtr(fn () void),
) !Embed {
return Embed{
.loop = loop,
.mutex = try Mutex.init(alloc),

View File

@ -96,10 +96,12 @@ pub fn Stream(comptime T: type) type {
});
if (result) |slice| {
buf.* = @bitCast(c.uv_buf_t, slice);
buf.* = .{
.base = slice.ptr,
.len = slice.len,
};
} else {
buf.*.base = null;
buf.*.len = 0;
buf.* = .{ .base = null, .len = 0 };
}
}
@ -112,7 +114,7 @@ pub fn Stream(comptime T: type) type {
@call(.{ .modifier = .always_inline }, read_cb, .{
&param,
cbnread,
@bitCast([]const u8, cbbuf.*),
cbbuf.*.base[0..cbbuf.*.len],
});
}
};