Skip to content
Browse files

Workaround buggy kqueue on os x.

On OS X, set haveOneShot = False and always wakeup the manager after a fd is registered.
  • Loading branch information...
1 parent dcad5a1 commit bcf8724642f3cec73587313878047c87fd61e18f @AndreasVoellmy AndreasVoellmy committed with tibbe Feb 8, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 GHC/Event/Manager.hs
View
8 GHC/Event/Manager.hs
@@ -135,7 +135,9 @@ callbackTableVar mgr fd = emFds mgr ! hashFd fd
haveOneShot :: Bool
{-# INLINE haveOneShot #-}
-#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE)
+#if defined(darwin_HOST_OS)
+haveOneShot = False
+#elif defined(HAVE_EPOLL) || defined(HAVE_KQUEUE)
haveOneShot = True
#else
haveOneShot = False
@@ -316,7 +318,9 @@ registerFd mgr cb fd evs = do
-- | Wake up the event manager.
wakeManager :: EventManager -> IO ()
-#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE)
+#if defined(darwin_HOST_OS)
+wakeManager mgr = sendWakeup (emControl mgr)
+#elif defined(HAVE_EPOLL) || defined(HAVE_KQUEUE)
wakeManager _ = return ()
#else
wakeManager mgr = sendWakeup (emControl mgr)

0 comments on commit bcf8724

Please sign in to comment.
Something went wrong with that request. Please try again.