diff --git a/ffi/zig/src/catalogue.zig b/ffi/zig/src/catalogue.zig index 99c268cb..16caf52d 100644 --- a/ffi/zig/src/catalogue.zig +++ b/ffi/zig/src/catalogue.zig @@ -12,15 +12,12 @@ const std = @import("std"); -const Mutex = struct { - state: std.atomic.Mutex = .unlocked, - pub fn lock(m: *Mutex) void { - while (!m.state.tryLock()) std.atomic.spinLoopHint(); - } - pub fn unlock(m: *Mutex) void { - m.state.unlock(); - } -}; +// `std.atomic.Mutex` was removed from the standard library; its replacement is +// `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled +// wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning +// a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other +// files in this repo already use this form. +const Mutex = std.Thread.Mutex; // ═══════════════════════════════════════════════════════════════════════ // Types (must match src/abi/Catalogue.idr encodings) diff --git a/ffi/zig/src/community.zig b/ffi/zig/src/community.zig index 70904be9..bb5e9271 100644 --- a/ffi/zig/src/community.zig +++ b/ffi/zig/src/community.zig @@ -15,15 +15,12 @@ const std = @import("std"); -const Mutex = struct { - state: std.atomic.Mutex = .unlocked, - pub fn lock(m: *Mutex) void { - while (!m.state.tryLock()) std.atomic.spinLoopHint(); - } - pub fn unlock(m: *Mutex) void { - m.state.unlock(); - } -}; +// `std.atomic.Mutex` was removed from the standard library; its replacement is +// `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled +// wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning +// a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other +// files in this repo already use this form. +const Mutex = std.Thread.Mutex; // ═══════════════════════════════════════════════════════════════════════ // Constants diff --git a/ffi/zig/src/coprocessor.zig b/ffi/zig/src/coprocessor.zig index 38ab9156..6f4919ba 100644 --- a/ffi/zig/src/coprocessor.zig +++ b/ffi/zig/src/coprocessor.zig @@ -20,15 +20,12 @@ const std = @import("std"); -const Mutex = struct { - state: std.atomic.Mutex = .unlocked, - pub fn lock(m: *Mutex) void { - while (!m.state.tryLock()) std.atomic.spinLoopHint(); - } - pub fn unlock(m: *Mutex) void { - m.state.unlock(); - } -}; +// `std.atomic.Mutex` was removed from the standard library; its replacement is +// `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled +// wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning +// a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other +// files in this repo already use this form. +const Mutex = std.Thread.Mutex; extern fn getenv(name: [*:0]const u8) ?[*:0]const u8; diff --git a/ffi/zig/src/federation.zig b/ffi/zig/src/federation.zig index 01b607cf..c65b3532 100644 --- a/ffi/zig/src/federation.zig +++ b/ffi/zig/src/federation.zig @@ -20,15 +20,12 @@ const std = @import("std"); -const Mutex = struct { - state: std.atomic.Mutex = .unlocked, - pub fn lock(m: *Mutex) void { - while (!m.state.tryLock()) std.atomic.spinLoopHint(); - } - pub fn unlock(m: *Mutex) void { - m.state.unlock(); - } -}; +// `std.atomic.Mutex` was removed from the standard library; its replacement is +// `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled +// wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning +// a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other +// files in this repo already use this form. +const Mutex = std.Thread.Mutex; // ═══════════════════════════════════════════════════════════════════════ // Proven-hardened: Circuit breaker, retry, and rate limiter state diff --git a/ffi/zig/src/guardian.zig b/ffi/zig/src/guardian.zig index 8370c029..0624cc1a 100644 --- a/ffi/zig/src/guardian.zig +++ b/ffi/zig/src/guardian.zig @@ -22,15 +22,12 @@ const std = @import("std"); -const Mutex = struct { - state: std.atomic.Mutex = .unlocked, - pub fn lock(m: *Mutex) void { - while (!m.state.tryLock()) std.atomic.spinLoopHint(); - } - pub fn unlock(m: *Mutex) void { - m.state.unlock(); - } -}; +// `std.atomic.Mutex` was removed from the standard library; its replacement is +// `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled +// wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning +// a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other +// files in this repo already use this form. +const Mutex = std.Thread.Mutex; // ═══════════════════════════════════════════════════════════════════════ // Constants diff --git a/ffi/zig/src/loader.zig b/ffi/zig/src/loader.zig index 40bd6d58..41bd1528 100644 --- a/ffi/zig/src/loader.zig +++ b/ffi/zig/src/loader.zig @@ -13,15 +13,12 @@ const std = @import("std"); -const Mutex = struct { - state: std.atomic.Mutex = .unlocked, - pub fn lock(m: *Mutex) void { - while (!m.state.tryLock()) std.atomic.spinLoopHint(); - } - pub fn unlock(m: *Mutex) void { - m.state.unlock(); - } -}; +// `std.atomic.Mutex` was removed from the standard library; its replacement is +// `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled +// wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning +// a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other +// files in this repo already use this form. +const Mutex = std.Thread.Mutex; const crypto = std.crypto; const fs = std.fs; diff --git a/ffi/zig/src/sdp.zig b/ffi/zig/src/sdp.zig index f3fe51a0..fbcde370 100644 --- a/ffi/zig/src/sdp.zig +++ b/ffi/zig/src/sdp.zig @@ -16,15 +16,12 @@ const std = @import("std"); -const Mutex = struct { - state: std.atomic.Mutex = .unlocked, - pub fn lock(m: *Mutex) void { - while (!m.state.tryLock()) std.atomic.spinLoopHint(); - } - pub fn unlock(m: *Mutex) void { - m.state.unlock(); - } -}; +// `std.atomic.Mutex` was removed from the standard library; its replacement is +// `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled +// wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning +// a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other +// files in this repo already use this form. +const Mutex = std.Thread.Mutex; // ═══════════════════════════════════════════════════════════════════════ // Constants diff --git a/ffi/zig/src/sla.zig b/ffi/zig/src/sla.zig index 50fe5342..a91d66dd 100644 --- a/ffi/zig/src/sla.zig +++ b/ffi/zig/src/sla.zig @@ -15,15 +15,12 @@ const std = @import("std"); -const Mutex = struct { - state: std.atomic.Mutex = .unlocked, - pub fn lock(m: *Mutex) void { - while (!m.state.tryLock()) std.atomic.spinLoopHint(); - } - pub fn unlock(m: *Mutex) void { - m.state.unlock(); - } -}; +// `std.atomic.Mutex` was removed from the standard library; its replacement is +// `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled +// wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning +// a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other +// files in this repo already use this form. +const Mutex = std.Thread.Mutex; // ═══════════════════════════════════════════════════════════════════════ // Constants diff --git a/ffi/zig/src/verisimdb.zig b/ffi/zig/src/verisimdb.zig index 8f857665..53935135 100644 --- a/ffi/zig/src/verisimdb.zig +++ b/ffi/zig/src/verisimdb.zig @@ -16,15 +16,12 @@ const std = @import("std"); -const Mutex = struct { - state: std.atomic.Mutex = .unlocked, - pub fn lock(m: *Mutex) void { - while (!m.state.tryLock()) std.atomic.spinLoopHint(); - } - pub fn unlock(m: *Mutex) void { - m.state.unlock(); - } -}; +// `std.atomic.Mutex` was removed from the standard library; its replacement is +// `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled +// wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning +// a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other +// files in this repo already use this form. +const Mutex = std.Thread.Mutex; const Allocator = std.mem.Allocator; // ═══════════════════════════════════════════════════════════════════════