[commit: base] : Added support for modifyFdOnce for the KQueue backend. (6dcfa64)
Johan Tibell
johan.tibell at gmail.com
Tue Feb 12 07:50:15 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch :
http://hackage.haskell.org/trac/ghc/changeset/6dcfa64192bb145a34fa4f72406fabe5dcbdd9e4
>---------------------------------------------------------------
commit 6dcfa64192bb145a34fa4f72406fabe5dcbdd9e4
Author: Andreas Voellmy <andreas.voellmy at gmail.com>
Date: Fri Dec 21 12:42:52 2012 -0500
Added support for modifyFdOnce for the KQueue backend.
>---------------------------------------------------------------
GHC/Event/KQueue.hsc | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/GHC/Event/KQueue.hsc b/GHC/Event/KQueue.hsc
index 7e467e9..ad32d8e 100644
--- a/GHC/Event/KQueue.hsc
+++ b/GHC/Event/KQueue.hsc
@@ -106,7 +106,9 @@ toFilter evt
| otherwise = filterWrite
modifyFdOnce :: EventQueue -> Fd -> E.Event -> IO ()
-modifyFdOnce = error "modifyFdOnce not supported in KQueue backend"
+modifyFdOnce q fd evt = do
+ let !ev = event fd (toFilter evt) (flagAdd .|. flagOneshot) noteEOF
+ kqueueControl (kqueueFd q) ev
poll :: EventQueue
-> Maybe Timeout
@@ -225,11 +227,12 @@ newtype Flag = Flag Word32
#else
newtype Flag = Flag Word16
#endif
- deriving (Eq, Show, Storable)
+ deriving (Bits, Eq, Num, Show, Storable)
#{enum Flag, Flag
, flagAdd = EV_ADD
, flagDelete = EV_DELETE
+ , flagOneshot = EV_ONESHOT
}
#if SIZEOF_KEV_FILTER == 4 /*kevent.filter: uint32_t or uint16_t. */
More information about the ghc-commits
mailing list