| author | |
| committer | |
| log | 5d9660972d4b2f1ed575978e8543c88e1392f6b5 |
| tree | a7090c98163834489a27eed925467718463a5c1e |
| parent | bd5dc75068dcfb3dcd6b8197ee5d941cacb15cb9 |
| parent | d70bd0b37eafb82e3020f163ebcbaa2c13791e75 |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31441
Reviewed-by: Andrew Kelley <andrew@ziglang.org>3 files changed, 4 insertions(+), 6 deletions(-)
lib/std/Io.zig+3-3| ... | ... | @@ -1577,11 +1577,11 @@ pub const Mutex = extern struct { |
| 1577 | 1577 | }; |
| 1578 | 1578 | |
| 1579 | 1579 | pub fn tryLock(m: *Mutex) bool { |
| 1580 | return m.state.cmpxchgWeak(.unlocked, .locked_once, .acquire, .monotonic) == null; | |
| 1580 | return m.state.cmpxchgStrong(.unlocked, .locked_once, .acquire, .monotonic) == null; | |
| 1581 | 1581 | } |
| 1582 | 1582 | |
| 1583 | 1583 | pub fn lock(m: *Mutex, io: Io) Cancelable!void { |
| 1584 | const initial_state = m.state.cmpxchgWeak( | |
| 1584 | const initial_state = m.state.cmpxchgStrong( | |
| 1585 | 1585 | .unlocked, |
| 1586 | 1586 | .locked_once, |
| 1587 | 1587 | .acquire, |
| ... | ... | @@ -1602,7 +1602,7 @@ pub const Mutex = extern struct { |
| 1602 | 1602 | /// |
| 1603 | 1603 | /// For a description of cancelation and cancelation points, see `Future.cancel`. |
| 1604 | 1604 | pub fn lockUncancelable(m: *Mutex, io: Io) void { |
| 1605 | const initial_state = m.state.cmpxchgWeak( | |
| 1605 | const initial_state = m.state.cmpxchgStrong( | |
| 1606 | 1606 | .unlocked, |
| 1607 | 1607 | .locked_once, |
| 1608 | 1608 | .acquire, |
lib/std/Io/RwLock.zig-2| ... | ... | @@ -114,8 +114,6 @@ test "internal state" { |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | test "smoke test" { |
| 117 | if (builtin.target.cpu.arch.isAARCH64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/31393 | |
| 118 | ||
| 119 | 117 | const io = testing.io; |
| 120 | 118 | |
| 121 | 119 | var rl: Io.RwLock = .init; |
lib/std/atomic.zig+1-1| ... | ... | @@ -509,7 +509,7 @@ pub const Mutex = enum(u8) { |
| 509 | 509 | locked, |
| 510 | 510 | |
| 511 | 511 | pub fn tryLock(m: *Mutex) bool { |
| 512 | return @cmpxchgWeak(Mutex, m, .unlocked, .locked, .acquire, .monotonic) == null; | |
| 512 | return @cmpxchgStrong(Mutex, m, .unlocked, .locked, .acquire, .monotonic) == null; | |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | pub fn unlock(m: *Mutex) void { |