Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : windows-iocp

http://hackage.haskell.org/trac/ghc/changeset/e15df2c9c2ca2781bba6f81a97f6ab0d5b48e26d

>---------------------------------------------------------------

commit e15df2c9c2ca2781bba6f81a97f6ab0d5b48e26d
Author: Joey Adams <[email protected]>
Date:   Sat Nov 17 22:43:45 2012 -0500

    Implement threadDelay with the new Windows IO manager

>---------------------------------------------------------------

 GHC/Conc/IO.hs |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/GHC/Conc/IO.hs b/GHC/Conc/IO.hs
index 94a63a9..372bbe9 100644
--- a/GHC/Conc/IO.hs
+++ b/GHC/Conc/IO.hs
@@ -65,6 +65,7 @@ import qualified GHC.Conc.Windows as Windows
 import GHC.Conc.Windows (asyncRead, asyncWrite, asyncDoProc, asyncReadBA,
                          asyncWriteBA, ConsoleEvent(..), win32ConsoleHandler,
                          toWin32ConsoleEvent)
+import qualified GHC.Event.Windows.Thread as Event
 #else
 import qualified GHC.Event.Thread as Event
 #endif
@@ -73,7 +74,9 @@ ensureIOManagerIsRunning :: IO ()
 #ifndef mingw32_HOST_OS
 ensureIOManagerIsRunning = Event.ensureIOManagerIsRunning
 #else
-ensureIOManagerIsRunning = Windows.ensureIOManagerIsRunning
+ensureIOManagerIsRunning = do
+    Event.ensureIOManagerIsRunning
+    Windows.ensureIOManagerIsRunning
 #endif
 
 -- | Block the current thread until data is available to read on the
@@ -134,11 +137,7 @@ closeFdWith close fd
 --
 threadDelay :: Int -> IO ()
 threadDelay time
-#ifdef mingw32_HOST_OS
-  | threaded  = Windows.threadDelay time
-#else
   | threaded  = Event.threadDelay time
-#endif
   | otherwise = IO $ \s ->
         case time of { I# time# ->
         case delay# time# s of { s' -> (# s', () #)
@@ -149,11 +148,7 @@ threadDelay time
 --
 registerDelay :: Int -> IO (TVar Bool)
 registerDelay usecs
-#ifdef mingw32_HOST_OS
-  | threaded = Windows.registerDelay usecs
-#else
   | threaded = Event.registerDelay usecs
-#endif
   | otherwise = error "registerDelay: requires -threaded"
 
 foreign import ccall unsafe "rtsSupportsBoundThreads" threaded :: Bool



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to