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

Read-Write Locks #735

Merged
merged 10 commits into from
Jul 22, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix locking
reading the docs every now and then is good; bug averted.
  • Loading branch information
vyzo committed Jul 22, 2023
commit 63051736c7a9e478c177ef2f052a6336f4e4d7d0
4 changes: 2 additions & 2 deletions src/std/misc/rwlock.ss
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

(def (rwlock-read-lock! rw)
(with ((rwlock mx cv) rw)
(mutex-lock! mx)
(let lp ()
(mutex-lock! mx)
(if (or (&rwlock-writer rw) (fx> (&rwlock-writers-waiting rw) 0))
(begin
(mutex-unlock! mx cv)
Expand All @@ -54,8 +54,8 @@

(def (rwlock-write-lock! rw)
(with ((rwlock mx cv) rw)
(mutex-lock! mx)
(let lp ((waiting? #f))
(mutex-lock! mx)
(cond
((or (fx> (&rwlock-readers rw) 0) (&rwlock-writer rw))
(unless waiting?
Expand Down