diff options
author | Kazu Yamamoto <kazu@iij.ad.jp> | 2012-12-26 15:07:03 +0900 |
---|---|---|
committer | Johan Tibell <johan.tibell@gmail.com> | 2013-02-11 21:38:06 -0800 |
commit | d55070bdfe6722f5b5c33a16e9d723913b54075e (patch) | |
tree | c1a0f7cef37522cd926e0e84fe4d287f93b917cc /libraries | |
parent | 12f3fef5ec52c1ec0958b674adcd981f48048428 (diff) | |
download | haskell-d55070bdfe6722f5b5c33a16e9d723913b54075e.tar.gz |
removing trailing white spaces.
Conflicts:
GHC/Event/Thread.hs
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/GHC/Event/Control.hs | 5 | ||||
-rw-r--r-- | libraries/base/GHC/Event/Manager.hs | 14 | ||||
-rw-r--r-- | libraries/base/GHC/Event/Thread.hs | 14 |
3 files changed, 16 insertions, 17 deletions
diff --git a/libraries/base/GHC/Event/Control.hs b/libraries/base/GHC/Event/Control.hs index e1b0aa0e5f..3f9f9ed8e2 100644 --- a/libraries/base/GHC/Event/Control.hs +++ b/libraries/base/GHC/Event/Control.hs @@ -170,7 +170,7 @@ sendWakeup :: Control -> IO () #if defined(HAVE_EVENTFD) sendWakeup c = throwErrnoIfMinus1_ "sendWakeup" $ - c_eventfd_write (fromIntegral (controlEventFd c)) 1 + c_eventfd_write (fromIntegral (controlEventFd c)) 1 #else sendWakeup c = do n <- sendMessage (wakeupWriteFd c) CMsgWakeup @@ -199,7 +199,7 @@ foreign import ccall unsafe "sys/eventfd.h eventfd" c_eventfd :: CInt -> CInt -> IO CInt foreign import ccall unsafe "sys/eventfd.h eventfd_write" - c_eventfd_write :: CInt -> CULong -> IO CInt + c_eventfd_write :: CInt -> CULong -> IO CInt #endif -- Used to tell the RTS how it can send messages to the I/O manager. @@ -208,4 +208,3 @@ foreign import ccall "setIOManagerControlFd" foreign import ccall "setIOManagerWakeupFd" c_setIOManagerWakeupFd :: CInt -> IO () - diff --git a/libraries/base/GHC/Event/Manager.hs b/libraries/base/GHC/Event/Manager.hs index 267d09fd20..45bf648ae9 100644 --- a/libraries/base/GHC/Event/Manager.hs +++ b/libraries/base/GHC/Event/Manager.hs @@ -264,7 +264,7 @@ registerFd_ mgr@(EventManager{..}) cb fd evs = do let fd' = fromIntegral fd reg = FdKey fd u !fdd = FdData reg evs cb - modifyMVar (callbackTableVar mgr fd) $ \oldMap -> + modifyMVar (callbackTableVar mgr fd) $ \oldMap -> #if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) if emOneShot then case IM.insertWith (++) fd' [fdd] oldMap of @@ -273,7 +273,7 @@ registerFd_ mgr@(EventManager{..}) cb fd evs = do (Just prev, n) -> do I.modifyFdOnce emBackend fd (combineEvents evs prev) return (n, (reg, False)) else -#endif +#endif let (!newMap, (oldEvs, newEvs)) = case IM.insertWith (++) fd' [fdd] oldMap of (Nothing, n) -> (n, (mempty, evs)) @@ -303,7 +303,7 @@ wakeManager :: EventManager -> IO () wakeManager mgr = #if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) return () -#else +#else sendWakeup (emControl mgr) #endif @@ -323,7 +323,7 @@ pairEvents prev m fd = let l = eventsOf prev unregisterFd_ :: EventManager -> FdKey -> IO Bool unregisterFd_ mgr@(EventManager{..}) (FdKey fd u) = modifyMVar (callbackTableVar mgr fd) $ \oldMap -> do - let dropReg = nullToNothing . filter ((/= u) . keyUnique . fdKey) + let dropReg = nullToNothing . filter ((/= u) . keyUnique . fdKey) fd' = fromIntegral fd (!newMap, (oldEvs, newEvs)) = case IM.updateWith dropReg fd' oldMap of @@ -382,7 +382,7 @@ onFdEvent mgr fd evs = (Nothing, _) -> return (oldMap, []) (Just cbs, newmap) -> selectCallbacks newmap cbs forM_ fdds $ \(FdData reg _ cb) -> cb reg evs - else + else do fds <- readMVar (callbackTableVar mgr fd) case IM.lookup fd' fds of Just cbs -> forM_ cbs $ \(FdData reg ev cb) -> do @@ -408,11 +408,11 @@ onFdEvent mgr fd evs = -- callback table for this fd, and we deleted above, so we know there -- is no entry in the table for this fd. aux [] fdds saved@(_:_) = do -#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) I.modifyFdOnce (emBackend mgr) fd $ eventsOf saved #else I.modifyFd (emBackend mgr) fd (eventsOf cbs) $ eventsOf saved -#endif +#endif return (snd $ IM.insertWith (\_ _ -> saved) fd' saved curmap, fdds) -- continue, saving those callbacks that don't match the event diff --git a/libraries/base/GHC/Event/Thread.hs b/libraries/base/GHC/Event/Thread.hs index b2aef8ab7e..99c3280ea1 100644 --- a/libraries/base/GHC/Event/Thread.hs +++ b/libraries/base/GHC/Event/Thread.hs @@ -120,7 +120,7 @@ threadWait evt fd = mask_ $ do threadWaitSTM :: Event -> Fd -> IO (STM (), IO ()) threadWaitSTM evt fd = mask_ $ do m <- newTVarIO Nothing - mgr <- getSystemEventManager + mgr <- getSystemEventManager reg <- registerFd mgr (\_ e -> atomically (writeTVar m (Just e))) fd evt let waitAction = do mevt <- readTVar m @@ -135,7 +135,7 @@ threadWaitSTM evt fd = mask_ $ do -- | Allows a thread to use an STM action to wait for a file descriptor to be readable. -- The STM action will retry until the file descriptor has data ready. -- The second element of the return value pair is an IO action that can be used --- to deregister interest in the file descriptor. +-- to deregister interest in the file descriptor. -- -- The STM action will throw an 'IOError' if the file descriptor was closed -- while the STM action is being executed. To safely close a file descriptor @@ -147,7 +147,7 @@ threadWaitReadSTM = threadWaitSTM evtRead -- | Allows a thread to use an STM action to wait until a file descriptor can accept a write. -- The STM action will retry while the file until the given file descriptor can accept a write. -- The second element of the return value pair is an IO action that can be used to deregister --- interest in the file descriptor. +-- interest in the file descriptor. -- -- The STM action will throw an 'IOError' if the file descriptor was closed -- while the STM action is being executed. To safely close a file descriptor @@ -196,7 +196,7 @@ ioManagerLock = unsafePerformIO $ do sharedCAF m getOrSetSystemEventThreadIOManagerThreadStore getSystemTimerManager :: IO TM.TimerManager -getSystemTimerManager = do +getSystemTimerManager = do Just mgr <- readIORef timerManager return mgr @@ -226,7 +226,7 @@ ensureIOManagerIsRunning startTimerManagerThread startIOManagerThreads :: IO () -startIOManagerThreads = +startIOManagerThreads = withMVar ioManagerLock $ \_ -> do eventManagerArray <- readIORef eventManager let (_, high) = boundsIOArray eventManagerArray @@ -256,7 +256,7 @@ startIOManagerThread eventManagerArray i = do s <- threadStatus t case s of ThreadFinished -> create - ThreadDied -> do + ThreadDied -> do -- Sanity check: if the thread has died, there is a chance -- that event manager is still alive. This could happend during -- the fork, for example. In this case we should clean up @@ -284,7 +284,7 @@ startTimerManagerThread = modifyMVar_ timerManagerThreadVar $ \old -> do s <- threadStatus t case s of ThreadFinished -> create - ThreadDied -> do + ThreadDied -> do -- Sanity check: if the thread has died, there is a chance -- that event manager is still alive. This could happend during -- the fork, for example. In this case we should clean up |