summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-12-23 16:31:57 +0100
committerAndy Wingo <wingo@pobox.com>2016-12-23 16:31:57 +0100
commit1f6ee76843b6ba2ced3191ad6da668f600f85f05 (patch)
tree6c9ecb19906629a8e517b5acce34ec3c99ecefd8
parentEnable work stealing in run-scheduler (diff)
downloadguile-fibers-1f6ee76843b6ba2ced3191ad6da668f600f85f05.tar.gz
Fix yield-current-fiber
* fibers/internal.scm (yield-current-fiber): Fix to allow yield-current-fiber to be run from an interrupt tick, when it's possible that no fiber is current.
-rw-r--r--fibers/internal.scm13
1 files changed, 8 insertions, 5 deletions
diff --git a/fibers/internal.scm b/fibers/internal.scm
index b69f3d0..813330b 100644
--- a/fibers/internal.scm
+++ b/fibers/internal.scm
@@ -371,11 +371,14 @@ even if @var{fiber} is running on a remote scheduler."
except that it avoids suspending if the current continuation isn't
suspendable. Returns @code{#t} if the yield succeeded, or @code{#f}
otherwise."
- (let ((tag (scheduler-prompt-tag (fiber-scheduler (current-fiber)))))
- (and (suspendable-continuation? tag)
- (begin
- (abort-to-prompt tag (lambda (fiber) (resume-fiber fiber #f)))
- #t))))
+ (match (current-fiber)
+ (#f #f)
+ (fiber
+ (let ((tag (scheduler-prompt-tag (fiber-scheduler fiber))))
+ (and (suspendable-continuation? tag)
+ (begin
+ (abort-to-prompt tag (lambda (fiber) (resume-fiber fiber #f)))
+ #t))))))
(define (finalize-fd sched fd)
"Remove data associated with @var{fd} from the scheduler @var{ctx}.