From d2bca43f5ddbdd19e560600b83c870a7fc71b9ce Mon Sep 17 00:00:00 2001 From: pfg Date: Mon, 23 Jun 2025 18:21:18 -0700 Subject: [PATCH] [skip ci] futex_wait/wake -> 4arg/3arg --- src/futex.zig | 16 ++++++++-------- src/sync.zig | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/futex.zig b/src/futex.zig index 76ae3ab0ff..46cd6f6d7a 100644 --- a/src/futex.zig +++ b/src/futex.zig @@ -223,10 +223,10 @@ const LinuxImpl = struct { else undefined; - const rc = linux.futex_wait( - @as(*const i32, @ptrCast(&ptr.raw)), - linux.FUTEX.PRIVATE_FLAG | linux.FUTEX.WAIT, - @as(i32, @bitCast(expect)), + const rc = linux.futex_4arg( + &ptr.raw, + .{ .cmd = .WAIT, .private = true }, + expect, if (timeout != null) &ts else null, ); @@ -245,10 +245,10 @@ const LinuxImpl = struct { } fn wake(ptr: *const atomic.Value(u32), max_waiters: u32) void { - const rc = linux.futex_wake( - @as(*const i32, @ptrCast(&ptr.raw)), - linux.FUTEX.PRIVATE_FLAG | linux.FUTEX.WAKE, - std.math.cast(i32, max_waiters) orelse std.math.maxInt(i32), + const rc = linux.futex_3arg( + &ptr.raw, + .{ .cmd = .WAKE, .private = true }, + max_waiters, ); switch (linux.E.init(rc)) { diff --git a/src/sync.zig b/src/sync.zig index 1f0b524048..594d20c2c8 100644 --- a/src/sync.zig +++ b/src/sync.zig @@ -1189,10 +1189,10 @@ else const Futex = switch (@import("builtin").os.tag) { .linux => struct { fn wait(ptr: *const i32, cmp: i32) void { - switch (system.getErrno(system.futex_wait( + switch (system.getErrno(system.futex_4arg( ptr, - system.FUTEX.PRIVATE_FLAG | system.FUTEX.WAIT, - cmp, + .{ .cmd = .WAIT, .private = true }, + @bitCast(cmp), null, ))) { 0 => {}, @@ -1203,10 +1203,10 @@ const Futex = switch (@import("builtin").os.tag) { } fn wake(ptr: *const i32) void { - switch (system.getErrno(system.futex_wake( + switch (system.getErrno(system.futex_3arg( ptr, - system.FUTEX.PRIVATE_FLAG | system.FUTEX.WAKE, - @as(i32, 1), + .{ .cmd = .WAKE, .private = true }, + 1, ))) { 0 => {}, std.posix.EFAULT => {},