diff --git a/racket/src/thread/schedule.rkt b/racket/src/thread/schedule.rkt index c15c339a48..3e24749734 100644 --- a/racket/src/thread/schedule.rkt +++ b/racket/src/thread/schedule.rkt @@ -40,7 +40,7 @@ (all-threads-poll-done?) (waiting-on-external-or-idle?)) (or (check-external-events 'slow) - (post-idle) + (try-post-idle) (process-sleep))) (define child (thread-group-next! g)) (cond @@ -196,6 +196,12 @@ ;; Maybe some thread can proceed: (thread-did-work!)) +(define (try-post-idle) + (and (post-idle) + (begin + (thread-did-work!) + #t))) + ;; ---------------------------------------- (define (accum-cpu-time! t) diff --git a/racket/src/thread/sync.rkt b/racket/src/thread/sync.rkt index 43b7dcdb15..993fc953d7 100644 --- a/racket/src/thread/sync.rkt +++ b/racket/src/thread/sync.rkt @@ -129,7 +129,8 @@ ;; Return result in a thunk: (lambda () #f)])] [(and (all-asynchronous? s) - (not (syncing-selected s))) + (not (syncing-selected s)) + (not (syncing-need-retry? s))) (suspend-syncing-thread s timeout-at) (set-syncing-wakeup! s void) (loop #f #t)]