From a1ac11aaf3484796ec223afeb8d6c273c6045f17 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Mon, 20 Feb 2017 20:25:12 +0100 Subject: Add block-asyncs in fiber->thread resume path * fibers/operations.scm (perform-operation): Block asyncs in resume callback; otherwise the fiber doing the resuming could be scheduled away. --- fibers/operations.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fibers/operations.scm b/fibers/operations.scm index 0008d3a..ef2969c 100644 --- a/fibers/operations.scm +++ b/fibers/operations.scm @@ -165,10 +165,12 @@ the operation cannot complete directly, block until it can complete." ((eq? (current-thread) thread) (set! k thunk)) (else - (lock-mutex mutex) - (set! k thunk) - (signal-condition-variable condvar) - (unlock-mutex mutex)))) + (call-with-blocked-asyncs + (lambda () + (lock-mutex mutex) + (set! k thunk) + (signal-condition-variable condvar) + (unlock-mutex mutex)))))) (lock-mutex mutex) (block #f resume) (let lp () -- cgit v1.2.3