[skip ci] futex_wait/wake -> 4arg/3arg

This commit is contained in:
pfg
2025-06-23 18:21:18 -07:00
parent 43b2c0e43a
commit d2bca43f5d
2 changed files with 14 additions and 14 deletions

View File

@@ -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)) {

View File

@@ -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 => {},