| ... | @@ -1337,25 +1337,6 @@ const Thread = struct { | ... | @@ -1337,25 +1337,6 @@ const Thread = struct { |
| 1337 | return @ptrFromInt(@as(usize, @bitCast(split))); | 1337 | return @ptrFromInt(@as(usize, @bitCast(split))); |
| 1338 | } | 1338 | } |
| 1339 | }; | 1339 | }; |
| 1340 | | | |
| 1341 | /// Same as `Io.Mutex.lock` but avoids the VTable. | | |
| 1342 | fn mutexLock(m: *Io.Mutex) Io.Cancelable!void { | | |
| 1343 | const initial_state = m.state.cmpxchgWeak( | | |
| 1344 | .unlocked, | | |
| 1345 | .locked_once, | | |
| 1346 | .acquire, | | |
| 1347 | .monotonic, | | |
| 1348 | ) orelse { | | |
| 1349 | @branchHint(.likely); | | |
| 1350 | return; | | |
| 1351 | }; | | |
| 1352 | if (initial_state == .contended) { | | |
| 1353 | try Thread.futexWait(@ptrCast(&m.state.raw), @intFromEnum(Io.Mutex.State.contended), null); | | |
| 1354 | } | | |
| 1355 | while (m.state.swap(.contended, .acquire) != .unlocked) { | | |
| 1356 | try Thread.futexWait(@ptrCast(&m.state.raw), @intFromEnum(Io.Mutex.State.contended), null); | | |
| 1357 | } | | |
| 1358 | } | | |
| 1359 | }; | 1340 | }; |
| 1360 | | 1341 | |
| 1361 | const Syscall = struct { | 1342 | const Syscall = struct { |
| ... | @@ -18663,7 +18644,7 @@ fn condWait(cond: *Io.Condition, mutex: *Io.Mutex) void { | ... | @@ -18663,7 +18644,7 @@ fn condWait(cond: *Io.Condition, mutex: *Io.Mutex) void { |
| 18663 | | 18644 | |
| 18664 | /// Same as `Io.Mutex.lockUncancelable` but avoids the VTable. | 18645 | /// Same as `Io.Mutex.lockUncancelable` but avoids the VTable. |
| 18665 | pub fn mutexLock(m: *Io.Mutex) void { | 18646 | pub fn mutexLock(m: *Io.Mutex) void { |
| 18666 | const initial_state = m.state.cmpxchgWeak( | 18647 | const initial_state = m.state.cmpxchgStrong( |
| 18667 | .unlocked, | 18648 | .unlocked, |
| 18668 | .locked_once, | 18649 | .locked_once, |
| 18669 | .acquire, | 18650 | .acquire, |