summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-02-20 20:25:12 +0100
committerAndy Wingo <wingo@pobox.com>2017-02-20 20:25:12 +0100
commita1ac11aaf3484796ec223afeb8d6c273c6045f17 (patch)
tree2d46f04d5b2c71b448128c2f91760ca2469e0261
parentUpdate (web server fibers) (diff)
downloadguile-fibers-a1ac11aaf3484796ec223afeb8d6c273c6045f17.tar.gz
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.
-rw-r--r--fibers/operations.scm10
1 files 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 ()