Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fsdk: fix build #40

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading