| ... | @@ -1348,7 +1348,13 @@ pub fn futexWake(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, m | ... | @@ -1348,7 +1348,13 @@ pub fn futexWake(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, m |
| 1348 | return io.vtable.futexWake(io.userdata, @ptrCast(ptr), max_waiters); | 1348 | return io.vtable.futexWake(io.userdata, @ptrCast(ptr), max_waiters); |
| 1349 | } | 1349 | } |
| 1350 | | 1350 | |
| 1351 | pub const Mutex = struct { | 1351 | /// Mutex is a synchronization primitive which enforces atomic access to a |
| | 1352 | /// shared region of code known as the "critical section". |
| | 1353 | /// |
| | 1354 | /// Mutex is an extern struct so that it may be used as a field inside another |
| | 1355 | /// extern struct. Having a guaranteed memory layout including mutexes is |
| | 1356 | /// important for IPC over shared memory (mmap). |
| | 1357 | pub const Mutex = extern struct { |
| 1352 | state: std.atomic.Value(State), | 1358 | state: std.atomic.Value(State), |
| 1353 | | 1359 | |
| 1354 | pub const init: Mutex = .{ .state = .init(.unlocked) }; | 1360 | pub const init: Mutex = .{ .state = .init(.unlocked) }; |