| ... | @@ -306,7 +306,7 @@ const FreebsdImpl = struct { | ... | @@ -306,7 +306,7 @@ const FreebsdImpl = struct { |
| 306 | } | 306 | } |
| 307 | | 307 | |
| 308 | const rc = os.freebsd._umtx_op( | 308 | const rc = os.freebsd._umtx_op( |
| 309 | @intFromPtr(&ptr.value), | 309 | @intFromPtr(&ptr.raw), |
| 310 | @intFromEnum(os.freebsd.UMTX_OP.WAIT_UINT_PRIVATE), | 310 | @intFromEnum(os.freebsd.UMTX_OP.WAIT_UINT_PRIVATE), |
| 311 | @as(c_ulong, expect), | 311 | @as(c_ulong, expect), |
| 312 | tm_size, | 312 | tm_size, |
| ... | @@ -328,7 +328,7 @@ const FreebsdImpl = struct { | ... | @@ -328,7 +328,7 @@ const FreebsdImpl = struct { |
| 328 | | 328 | |
| 329 | fn wake(ptr: *const atomic.Value(u32), max_waiters: u32) void { | 329 | fn wake(ptr: *const atomic.Value(u32), max_waiters: u32) void { |
| 330 | const rc = os.freebsd._umtx_op( | 330 | const rc = os.freebsd._umtx_op( |
| 331 | @intFromPtr(&ptr.value), | 331 | @intFromPtr(&ptr.raw), |
| 332 | @intFromEnum(os.freebsd.UMTX_OP.WAKE_PRIVATE), | 332 | @intFromEnum(os.freebsd.UMTX_OP.WAKE_PRIVATE), |
| 333 | @as(c_ulong, max_waiters), | 333 | @as(c_ulong, max_waiters), |
| 334 | 0, // there is no timeout struct | 334 | 0, // there is no timeout struct |
| ... | @@ -354,7 +354,7 @@ const OpenbsdImpl = struct { | ... | @@ -354,7 +354,7 @@ const OpenbsdImpl = struct { |
| 354 | } | 354 | } |
| 355 | | 355 | |
| 356 | const rc = os.openbsd.futex( | 356 | const rc = os.openbsd.futex( |
| 357 | @as(*const volatile u32, @ptrCast(&ptr.value)), | 357 | @as(*const volatile u32, @ptrCast(&ptr.raw)), |
| 358 | os.openbsd.FUTEX_WAIT | os.openbsd.FUTEX_PRIVATE_FLAG, | 358 | os.openbsd.FUTEX_WAIT | os.openbsd.FUTEX_PRIVATE_FLAG, |
| 359 | @as(c_int, @bitCast(expect)), | 359 | @as(c_int, @bitCast(expect)), |
| 360 | if (timeout != null) &ts else null, | 360 | if (timeout != null) &ts else null, |
| ... | @@ -379,7 +379,7 @@ const OpenbsdImpl = struct { | ... | @@ -379,7 +379,7 @@ const OpenbsdImpl = struct { |
| 379 | | 379 | |
| 380 | fn wake(ptr: *const atomic.Value(u32), max_waiters: u32) void { | 380 | fn wake(ptr: *const atomic.Value(u32), max_waiters: u32) void { |
| 381 | const rc = os.openbsd.futex( | 381 | const rc = os.openbsd.futex( |
| 382 | @as(*const volatile u32, @ptrCast(&ptr.value)), | 382 | @as(*const volatile u32, @ptrCast(&ptr.raw)), |
| 383 | os.openbsd.FUTEX_WAKE | os.openbsd.FUTEX_PRIVATE_FLAG, | 383 | os.openbsd.FUTEX_WAKE | os.openbsd.FUTEX_PRIVATE_FLAG, |
| 384 | std.math.cast(c_int, max_waiters) orelse std.math.maxInt(c_int), | 384 | std.math.cast(c_int, max_waiters) orelse std.math.maxInt(c_int), |
| 385 | null, // FUTEX_WAKE takes no timeout ptr | 385 | null, // FUTEX_WAKE takes no timeout ptr |
| ... | @@ -414,7 +414,7 @@ const DragonflyImpl = struct { | ... | @@ -414,7 +414,7 @@ const DragonflyImpl = struct { |
| 414 | } | 414 | } |
| 415 | | 415 | |
| 416 | const value = @as(c_int, @bitCast(expect)); | 416 | const value = @as(c_int, @bitCast(expect)); |
| 417 | const addr = @as(*const volatile c_int, @ptrCast(&ptr.value)); | 417 | const addr = @as(*const volatile c_int, @ptrCast(&ptr.raw)); |
| 418 | const rc = os.dragonfly.umtx_sleep(addr, value, timeout_us); | 418 | const rc = os.dragonfly.umtx_sleep(addr, value, timeout_us); |
| 419 | | 419 | |
| 420 | switch (os.errno(rc)) { | 420 | switch (os.errno(rc)) { |
| ... | @@ -443,7 +443,7 @@ const DragonflyImpl = struct { | ... | @@ -443,7 +443,7 @@ const DragonflyImpl = struct { |
| 443 | // https://man.dragonflybsd.org/?command=umtx&section=2 | 443 | // https://man.dragonflybsd.org/?command=umtx&section=2 |
| 444 | // > umtx_wakeup() will generally return 0 unless the address is bad. | 444 | // > umtx_wakeup() will generally return 0 unless the address is bad. |
| 445 | // We are fine with the address being bad (e.g. for Semaphore.post() where Semaphore.wait() frees the Semaphore) | 445 | // We are fine with the address being bad (e.g. for Semaphore.post() where Semaphore.wait() frees the Semaphore) |
| 446 | const addr = @as(*const volatile c_int, @ptrCast(&ptr.value)); | 446 | const addr = @as(*const volatile c_int, @ptrCast(&ptr.raw)); |
| 447 | _ = os.dragonfly.umtx_wakeup(addr, to_wake); | 447 | _ = os.dragonfly.umtx_wakeup(addr, to_wake); |
| 448 | } | 448 | } |
| 449 | }; | 449 | }; |
| ... | @@ -461,7 +461,7 @@ const WasmImpl = struct { | ... | @@ -461,7 +461,7 @@ const WasmImpl = struct { |
| 461 | \\memory.atomic.wait32 0 | 461 | \\memory.atomic.wait32 0 |
| 462 | \\local.set %[ret] | 462 | \\local.set %[ret] |
| 463 | : [ret] "=r" (-> u32), | 463 | : [ret] "=r" (-> u32), |
| 464 | : [ptr] "r" (&ptr.value), | 464 | : [ptr] "r" (&ptr.raw), |
| 465 | [expected] "r" (@as(i32, @bitCast(expect))), | 465 | [expected] "r" (@as(i32, @bitCast(expect))), |
| 466 | [timeout] "r" (to), | 466 | [timeout] "r" (to), |
| 467 | ); | 467 | ); |
| ... | @@ -484,7 +484,7 @@ const WasmImpl = struct { | ... | @@ -484,7 +484,7 @@ const WasmImpl = struct { |
| 484 | \\memory.atomic.notify 0 | 484 | \\memory.atomic.notify 0 |
| 485 | \\local.set %[ret] | 485 | \\local.set %[ret] |
| 486 | : [ret] "=r" (-> u32), | 486 | : [ret] "=r" (-> u32), |
| 487 | : [ptr] "r" (&ptr.value), | 487 | : [ptr] "r" (&ptr.raw), |
| 488 | [waiters] "r" (max_waiters), | 488 | [waiters] "r" (max_waiters), |
| 489 | ); | 489 | ); |
| 490 | _ = woken_count; // can be 0 when linker flag 'shared-memory' is not enabled | 490 | _ = woken_count; // can be 0 when linker flag 'shared-memory' is not enabled |