summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-02-08 15:17:35 +0100
committerAndy Wingo <wingo@pobox.com>2017-02-08 15:17:35 +0100
commitc91338e3c41e640da8911befc8f14e595449d9ca (patch)
treeef28e8d11dab07ae05c6c2719f2ddc3185c3052c
parentPrevent GC from waking up epoll (diff)
downloadguile-fibers-c91338e3c41e640da8911befc8f14e595449d9ca.tar.gz
Fix channel CAS logic
* fibers/channels.scm (put-operation, get-operation): Fix bogus CAS that could cause us to spin in an allocation loop.
-rw-r--r--fibers/channels.scm8
1 files changed, 4 insertions, 4 deletions
diff --git a/fibers/channels.scm b/fibers/channels.scm
index 9f946da..aabf2db 100644
--- a/fibers/channels.scm
+++ b/fibers/channels.scm
@@ -69,7 +69,7 @@ with a receiver fiber to send @var{message} over @var{channel}."
;; Try to update getq. Return the new getq value in
;; any case.
(let ((q (atomic-box-compare-and-swap! getq-box getq getq*)))
- (if (eq? q getq) getq* getq)))
+ (if (eq? q getq) getq* q)))
;; Return #f if the getq was empty.
(and getq*
(match item
@@ -124,7 +124,7 @@ with a receiver fiber to send @var{message} over @var{channel}."
;; Try to update getq. Return the new getq value in
;; any case.
(let ((q (atomic-box-compare-and-swap! getq-box getq getq*)))
- (if (eq? q getq) getq* getq)))
+ (if (eq? q getq) getq* q)))
;; We only have to service the getq if it is non-empty.
(when getq*
(match item
@@ -186,7 +186,7 @@ with a sender fiber to receive one value from @var{channel}."
;; Try to update putq. Return the new putq value in
;; any case.
(let ((q (atomic-box-compare-and-swap! putq-box putq putq*)))
- (if (eq? q putq) putq* putq)))
+ (if (eq? q putq) putq* q)))
;; Return #f if the putq was empty.
(and putq*
(match item
@@ -239,7 +239,7 @@ with a sender fiber to receive one value from @var{channel}."
;; Try to update putq. Return the new putq value in
;; any case.
(let ((q (atomic-box-compare-and-swap! putq-box putq putq*)))
- (if (eq? q putq) putq* putq)))
+ (if (eq? q putq) putq* q)))
;; We only have to service the putq if it is non-empty.
(when putq*
(match item