Skip to content

Commit

Permalink
Merge PR #40 from nblockchain/wip/fixVolatileBuild
Browse files Browse the repository at this point in the history
Fsdk: fix build.
  • Loading branch information
knocte authored Feb 19, 2024
2 parents d2ffbed + f3b6785 commit 29521ed
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Fsdk/Process.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ module Process =
// https://stackoverflow.com/a/961904/544947
type internal QueuedLock() =
let innerLock = Object()
let ticketsCount = ref 0
let ticketToRide = ref 1
let mutable ticketsCount = 0
let mutable ticketToRide = 1

member __.Enter() =
let myTicket = Interlocked.Increment ticketsCount
let myTicket = Interlocked.Increment &ticketsCount
Monitor.Enter innerLock

while myTicket <> Volatile.Read ticketToRide do
while myTicket <> Volatile.Read &ticketToRide do
Monitor.Wait innerLock |> ignore

member __.Exit() =
Interlocked.Increment ticketToRide |> ignore
Interlocked.Increment &ticketToRide |> ignore
Monitor.PulseAll innerLock
Monitor.Exit innerLock

Expand Down

0 comments on commit 29521ed

Please sign in to comment.