mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 05:42:43 +00:00
[skip ci] futex_wait/wake -> 4arg/3arg
This commit is contained in:
@@ -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)) {
|
||||
|
||||
12
src/sync.zig
12
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 => {},
|
||||
|
||||
Reference in New Issue
Block a user