thread: avoid repeated polls while scanning available threads
Poll for external events just once before starting a search for an available thread, instead of polling every iteration in the search.
This commit is contained in:
parent
6d200e6143
commit
97e61b5f25
|
@ -55,7 +55,6 @@
|
||||||
(set! thread-swap-count 0))
|
(set! thread-swap-count 0))
|
||||||
|
|
||||||
(define (select-thread! [pending-callbacks null])
|
(define (select-thread! [pending-callbacks null])
|
||||||
(let loop ([g root-thread-group] [pending-callbacks pending-callbacks] [none-k maybe-done])
|
|
||||||
(define callbacks (if (null? pending-callbacks)
|
(define callbacks (if (null? pending-callbacks)
|
||||||
(host:poll-async-callbacks)
|
(host:poll-async-callbacks)
|
||||||
pending-callbacks))
|
pending-callbacks))
|
||||||
|
@ -71,6 +70,7 @@
|
||||||
(or (check-external-events 'slow)
|
(or (check-external-events 'slow)
|
||||||
(try-post-idle)
|
(try-post-idle)
|
||||||
(process-sleep)))
|
(process-sleep)))
|
||||||
|
(let loop ([g root-thread-group] [pending-callbacks pending-callbacks] [none-k maybe-done])
|
||||||
(define child (thread-group-next! g))
|
(define child (thread-group-next! g))
|
||||||
(cond
|
(cond
|
||||||
[(not child) (none-k callbacks)]
|
[(not child) (none-k callbacks)]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user