Skip to content

Commit

Permalink
thread: small simplification in scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
mflatt committed Dec 29, 2019
1 parent 38b789d commit b8a4e05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion racket/src/cs/rumble/control.ss
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
mark-chain ; #f or a cached list of mark-chain-frame or elem+cache
traces ; #f or a cached list of traces
cc-guard ; for impersonated tag, initially #f
avail-cache)) ; cache for `continuation-pompt-available?`
avail-cache)) ; cache for `continuation-prompt-available?`

;; Messages to `resume-k[/no-wind]`:
(define-record aborting (args))
Expand Down
9 changes: 4 additions & 5 deletions racket/src/thread/schedule.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@
(current-thread/in-atomic t)
(set-place-current-thread! current-place t)
(set! thread-swap-count (add1 thread-swap-count))
(run-callbacks-in-engine e callbacks t leftover-ticks
swap-in-engine))
(run-callbacks-in-engine e callbacks t leftover-ticks))

(define (swap-in-engine e t leftover-ticks)
(let loop ([e e])
Expand Down Expand Up @@ -212,9 +211,9 @@

;; Run callbacks within the thread for `e`, and don't give up until
;; the callbacks are done
(define (run-callbacks-in-engine e callbacks t leftover-ticks k)
(define (run-callbacks-in-engine e callbacks t leftover-ticks)
(cond
[(null? callbacks) (k e t leftover-ticks)]
[(null? callbacks) (swap-in-engine e t leftover-ticks)]
[else
(define done? #f)
(let loop ([e e])
Expand All @@ -230,7 +229,7 @@
(unless e
(internal-error "thread ended while it should run callbacks atomically"))
(if done?
(k e t leftover-ticks)
(swap-in-engine e t leftover-ticks)
(loop e)))))]))

;; Run foreign "async-apply" callbacks, now that we're in some thread
Expand Down

0 comments on commit b8a4e05

Please sign in to comment.