[commit: base] master: minor refactoring. (c393e0a)
Johan Tibell
johan.tibell at gmail.com
Tue Feb 12 07:50:39 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/c393e0af3a6893688e6a2a21b96499745c6d68bc
>---------------------------------------------------------------
commit c393e0af3a6893688e6a2a21b96499745c6d68bc
Author: Kazu Yamamoto <kazu at iij.ad.jp>
Date: Fri Dec 28 12:51:32 2012 +0900
minor refactoring.
>---------------------------------------------------------------
GHC/Event/EPoll.hsc | 5 +++--
GHC/Event/KQueue.hsc | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/GHC/Event/EPoll.hsc b/GHC/Event/EPoll.hsc
index 1f6e2e7..c7a7662 100644
--- a/GHC/Event/EPoll.hsc
+++ b/GHC/Event/EPoll.hsc
@@ -115,12 +115,13 @@ poll :: EPoll -- ^ state
-> IO Int
poll ep mtimeout f = do
let events = epollEvents ep
+ fd = epollFd ep
-- Will return zero if the system call was interupted, in which case
-- we just return (and try again later.)
n <- A.unsafeLoad events $ \es cap -> case mtimeout of
- Just timeout -> epollWait (epollFd ep) es cap $ fromTimeout timeout
- Nothing -> epollWaitNonBlock (epollFd ep) es cap
+ Just timeout -> epollWait fd es cap $ fromTimeout timeout
+ Nothing -> epollWaitNonBlock fd es cap
when (n > 0) $ do
A.forM_ events $ \e -> f (eventFd e) (toEvent (eventTypes e))
diff --git a/GHC/Event/KQueue.hsc b/GHC/Event/KQueue.hsc
index 09e7084..2d37546 100644
--- a/GHC/Event/KQueue.hsc
+++ b/GHC/Event/KQueue.hsc
@@ -116,10 +116,11 @@ poll :: KQueue
-> IO Int
poll kq mtimeout f = do
let events = kqueueEvents kq
+ fd = kqueueFd kq
n <- A.unsafeLoad events $ \es cap -> case mtimeout of
- Just timeout -> kqueueWait (kqueueFd kq) es cap $ fromTimeout timeout
- Nothing -> kqueueWaitNonBlock (kqueueFd kq) es cap
+ Just timeout -> kqueueWait fd es cap $ fromTimeout timeout
+ Nothing -> kqueueWaitNonBlock fd es cap
when (n > 0) $ do
A.forM_ events $ \e -> f (fromIntegral (ident e)) (toEvent (filter e))
More information about the ghc-commits
mailing list