summaryrefslogtreecommitdiff
path: root/fibers
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-02-20 20:08:52 +0100
committerAndy Wingo <wingo@pobox.com>2017-02-20 20:09:55 +0100
commit7a4dd4cdf26192659e5312348c18fd5858e7766d (patch)
treeb1cd294515568e45f26a8aafed29c6e01c72bd92 /fibers
parentUpdate REPL support for run-fibers changes. (diff)
downloadguile-fibers-7a4dd4cdf26192659e5312348c18fd5858e7766d.tar.gz
Fix epoll wakeup
* fibers/epoll.scm (epoll): Like a complete idiot, I broke epoll wakeup. Fixed by calling expiry->timeout while epoll-state is waiting.
Diffstat (limited to 'fibers')
-rw-r--r--fibers/epoll.scm12
1 files changed, 7 insertions, 5 deletions
diff --git a/fibers/epoll.scm b/fibers/epoll.scm
index 55d88a3..d26db4d 100644
--- a/fibers/epoll.scm
+++ b/fibers/epoll.scm
@@ -164,12 +164,14 @@ epoll wait (if appropriate)."
(let* ((maxevents (epoll-maxevents epoll))
(eventsv (ensure-epoll-eventsv epoll maxevents))
(write-pipe-fd (fileno (epoll-wake-write-pipe epoll)))
- (read-pipe-fd (fileno (epoll-wake-read-pipe epoll)))
- (timeout (expiry->timeout (update-expiry expiry))))
+ (read-pipe-fd (fileno (epoll-wake-read-pipe epoll))))
(atomic-box-set! (epoll-state epoll) 'waiting)
- (let ((n (primitive-epoll-wait (epoll-fd epoll)
- write-pipe-fd read-pipe-fd
- eventsv timeout)))
+ ;; Note: update-expiry call must take place after epoll-state is
+ ;; set to waiting.
+ (let* ((timeout (expiry->timeout (update-expiry expiry)))
+ (n (primitive-epoll-wait (epoll-fd epoll)
+ write-pipe-fd read-pipe-fd
+ eventsv timeout)))
(atomic-box-set! (epoll-state epoll) 'not-waiting)
;; If we received `maxevents' events, it means that probably there
;; are more active fd's in the queue that we were unable to