File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212
1313const std = @import ("std" );
1414
15- const Mutex = struct {
16- state : std.atomic.Mutex = .unlocked ,
17- pub fn lock (m : * Mutex ) void {
18- while (! m .state .tryLock ()) std .atomic .spinLoopHint ();
19- }
20- pub fn unlock (m : * Mutex ) void {
21- m .state .unlock ();
22- }
23- };
15+ // `std.atomic.Mutex` was removed from the standard library; its replacement is
16+ // `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled
17+ // wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning
18+ // a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other
19+ // files in this repo already use this form.
20+ const Mutex = std .Thread .Mutex ;
2421
2522// ═══════════════════════════════════════════════════════════════════════
2623// Types (must match src/abi/Catalogue.idr encodings)
Original file line number Diff line number Diff line change 1515
1616const std = @import ("std" );
1717
18- const Mutex = struct {
19- state : std.atomic.Mutex = .unlocked ,
20- pub fn lock (m : * Mutex ) void {
21- while (! m .state .tryLock ()) std .atomic .spinLoopHint ();
22- }
23- pub fn unlock (m : * Mutex ) void {
24- m .state .unlock ();
25- }
26- };
18+ // `std.atomic.Mutex` was removed from the standard library; its replacement is
19+ // `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled
20+ // wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning
21+ // a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other
22+ // files in this repo already use this form.
23+ const Mutex = std .Thread .Mutex ;
2724
2825// ═══════════════════════════════════════════════════════════════════════
2926// Constants
Original file line number Diff line number Diff line change 2020
2121const std = @import ("std" );
2222
23- const Mutex = struct {
24- state : std.atomic.Mutex = .unlocked ,
25- pub fn lock (m : * Mutex ) void {
26- while (! m .state .tryLock ()) std .atomic .spinLoopHint ();
27- }
28- pub fn unlock (m : * Mutex ) void {
29- m .state .unlock ();
30- }
31- };
23+ // `std.atomic.Mutex` was removed from the standard library; its replacement is
24+ // `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled
25+ // wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning
26+ // a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other
27+ // files in this repo already use this form.
28+ const Mutex = std .Thread .Mutex ;
3229
3330extern fn getenv (name : [* :0 ]const u8 ) ? [* :0 ]const u8 ;
3431
Original file line number Diff line number Diff line change 2020
2121const std = @import ("std" );
2222
23- const Mutex = struct {
24- state : std.atomic.Mutex = .unlocked ,
25- pub fn lock (m : * Mutex ) void {
26- while (! m .state .tryLock ()) std .atomic .spinLoopHint ();
27- }
28- pub fn unlock (m : * Mutex ) void {
29- m .state .unlock ();
30- }
31- };
23+ // `std.atomic.Mutex` was removed from the standard library; its replacement is
24+ // `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled
25+ // wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning
26+ // a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other
27+ // files in this repo already use this form.
28+ const Mutex = std .Thread .Mutex ;
3229
3330// ═══════════════════════════════════════════════════════════════════════
3431// Proven-hardened: Circuit breaker, retry, and rate limiter state
Original file line number Diff line number Diff line change 2222
2323const std = @import ("std" );
2424
25- const Mutex = struct {
26- state : std.atomic.Mutex = .unlocked ,
27- pub fn lock (m : * Mutex ) void {
28- while (! m .state .tryLock ()) std .atomic .spinLoopHint ();
29- }
30- pub fn unlock (m : * Mutex ) void {
31- m .state .unlock ();
32- }
33- };
25+ // `std.atomic.Mutex` was removed from the standard library; its replacement is
26+ // `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled
27+ // wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning
28+ // a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other
29+ // files in this repo already use this form.
30+ const Mutex = std .Thread .Mutex ;
3431
3532// ═══════════════════════════════════════════════════════════════════════
3633// Constants
Original file line number Diff line number Diff line change 1313
1414const std = @import ("std" );
1515
16- const Mutex = struct {
17- state : std.atomic.Mutex = .unlocked ,
18- pub fn lock (m : * Mutex ) void {
19- while (! m .state .tryLock ()) std .atomic .spinLoopHint ();
20- }
21- pub fn unlock (m : * Mutex ) void {
22- m .state .unlock ();
23- }
24- };
16+ // `std.atomic.Mutex` was removed from the standard library; its replacement is
17+ // `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled
18+ // wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning
19+ // a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other
20+ // files in this repo already use this form.
21+ const Mutex = std .Thread .Mutex ;
2522const crypto = std .crypto ;
2623const fs = std .fs ;
2724
Original file line number Diff line number Diff line change 1616
1717const std = @import ("std" );
1818
19- const Mutex = struct {
20- state : std.atomic.Mutex = .unlocked ,
21- pub fn lock (m : * Mutex ) void {
22- while (! m .state .tryLock ()) std .atomic .spinLoopHint ();
23- }
24- pub fn unlock (m : * Mutex ) void {
25- m .state .unlock ();
26- }
27- };
19+ // `std.atomic.Mutex` was removed from the standard library; its replacement is
20+ // `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled
21+ // wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning
22+ // a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other
23+ // files in this repo already use this form.
24+ const Mutex = std .Thread .Mutex ;
2825
2926// ═══════════════════════════════════════════════════════════════════════
3027// Constants
Original file line number Diff line number Diff line change 1515
1616const std = @import ("std" );
1717
18- const Mutex = struct {
19- state : std.atomic.Mutex = .unlocked ,
20- pub fn lock (m : * Mutex ) void {
21- while (! m .state .tryLock ()) std .atomic .spinLoopHint ();
22- }
23- pub fn unlock (m : * Mutex ) void {
24- m .state .unlock ();
25- }
26- };
18+ // `std.atomic.Mutex` was removed from the standard library; its replacement is
19+ // `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled
20+ // wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning
21+ // a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other
22+ // files in this repo already use this form.
23+ const Mutex = std .Thread .Mutex ;
2724
2825// ═══════════════════════════════════════════════════════════════════════
2926// Constants
Original file line number Diff line number Diff line change 1616
1717const std = @import ("std" );
1818
19- const Mutex = struct {
20- state : std.atomic.Mutex = .unlocked ,
21- pub fn lock (m : * Mutex ) void {
22- while (! m .state .tryLock ()) std .atomic .spinLoopHint ();
23- }
24- pub fn unlock (m : * Mutex ) void {
25- m .state .unlock ();
26- }
27- };
19+ // `std.atomic.Mutex` was removed from the standard library; its replacement is
20+ // `std.Thread.Mutex`, whose lock/unlock surface is identical to the hand-rolled
21+ // wrapper this replaces. The wrapper also busy-waited via `spinLoopHint`, burning
22+ // a core under contention; `std.Thread.Mutex` parks the thread instead. 81 other
23+ // files in this repo already use this form.
24+ const Mutex = std .Thread .Mutex ;
2825const Allocator = std .mem .Allocator ;
2926
3027// ═══════════════════════════════════════════════════════════════════════
You can’t perform that action at this time.
0 commit comments