Skip to content

Commit

Permalink
scheduler: (runcount) Exlain absence of atomic-box-compare-and-swap!.
Browse files Browse the repository at this point in the history
Closes: #48
Reported-by: cireu (with some adjustments)

* fibers/scheduler.scm (run-scheduler)[run-task]: Explain it.
  • Loading branch information
emixa-d committed Sep 14, 2023
1 parent 3ba92d9 commit 272592b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fibers/scheduler.scm
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ value. Return zero values."
(cur (scheduler-current-runqueue sched))
(steal-work! (work-stealer sched)))
(define (run-task task)
;; The only thread writing to the runcount box is the thread of SCHED,
;; so no need for atomic-box-compare-and-swap! here.
(atomic-box-set! runcount-box
(logand (1+ (atomic-box-ref runcount-box)) #xffffFFFF))
(call-with-prompt tag
Expand Down

0 comments on commit 272592b

Please sign in to comment.