| ... | ... | @@ -1236,15 +1236,7 @@ pub const Mutex = extern struct { |
| 1236 | 1236 | }; |
| 1237 | 1237 | |
| 1238 | 1238 | pub fn tryLock(m: *Mutex) bool { |
| 1239 | | switch (m.state.cmpxchgWeak( |
| 1240 | | .unlocked, |
| 1241 | | .locked_once, |
| 1242 | | .acquire, |
| 1243 | | .monotonic, |
| 1244 | | ) orelse return true) { |
| 1245 | | .unlocked => unreachable, |
| 1246 | | .locked_once, .contended => return false, |
| 1247 | | } |
| 1239 | return m.state.cmpxchgWeak(.unlocked, .locked_once, .acquire, .monotonic) == null; |
| 1248 | 1240 | } |
| 1249 | 1241 | |
| 1250 | 1242 | pub fn lock(m: *Mutex, io: Io) Cancelable!void { |