diff options
author | 2021-08-25 17:56:06 -0700 | |
---|---|---|
committer | 2021-08-25 17:56:06 -0700 | |
commit | 454160646923e98f00e53df025e324d3d2c585d0 (patch) | |
tree | 731c5243ac48077ffa1f974dcf46f3bc176792b6 /src/lock.zig | |
parent | 039bf6ecdb0be85ca78045b647de01bd176823c6 (diff) | |
download | bun-454160646923e98f00e53df025e324d3d2c585d0.tar.gz bun-454160646923e98f00e53df025e324d3d2c585d0.tar.zst bun-454160646923e98f00e53df025e324d3d2c585d0.zip |
latest
Former-commit-id: f5600d123d3710e7ea80ff2b7c66d13382462420
Diffstat (limited to 'src/lock.zig')
-rw-r--r-- | src/lock.zig | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lock.zig b/src/lock.zig index e76a4cdf7..73dfdebd2 100644 --- a/src/lock.zig +++ b/src/lock.zig @@ -41,7 +41,7 @@ pub const Mutex = struct { var acquire_state = LOCKED; var state = self.state.load(.Monotonic); - var spin: u8 = if (has_fast_swap) 100 else 10; + var spin: u8 = if (comptime has_fast_swap) 100 else 10; while (true) { // Try to lock the Mutex if its unlocked. @@ -75,7 +75,7 @@ pub const Mutex = struct { // Indicate that there will be a waiting thread by updating to CONTENDED. // Acquire barrier as this swap could also possibly lock the Mutex. - if (has_fast_swap) { + if (comptime has_fast_swap) { state = self.state.swap(CONTENDED, .Acquire); if (state == UNLOCKED) return; break :uncontended; @@ -135,3 +135,8 @@ pub const Lock = struct { this.mutex.release(); } }; + + +pub fn spinCycle() void { + +}
\ No newline at end of file |