Skip to content

Commit

Permalink
refactor: Use Windows WSAPoll to avoid libc
Browse files Browse the repository at this point in the history
  • Loading branch information
mochalins committed Jun 23, 2024
1 parent e1553f4 commit b416856
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion network.zig
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,12 @@ const WindowsOSLogic = LinuxOSLogic;
/// actual timeout interval shall be rounded up to the next supported value.
pub fn waitForSocketEvent(set: *SocketSet, timeout: ?u64) !usize {
switch (builtin.os.tag) {
.windows, .linux, .macos, .ios, .watchos, .tvos => return try std.posix.poll(
.windows => return try std.os.windows.poll(
set.internal.fds.items.ptr,
set.internal.fds.items.len,
if (timeout) |val| @as(i32, @intCast((val + std.time.ns_per_ms - 1) / std.time.ns_per_ms)) else -1,
),
.linux, .macos, .ios, .watchos, .tvos => return try std.posix.poll(
set.internal.fds.items,
if (timeout) |val| @as(i32, @intCast((val + std.time.ns_per_ms - 1) / std.time.ns_per_ms)) else -1,
),
Expand Down

0 comments on commit b416856

Please sign in to comment.