Duncan Coutts pushed to branch wip/dcoutts/io-manager-tidy at Glasgow Haskell Compiler / GHC
Commits:
-
1fb92614
by Duncan Coutts at 2026-06-18T23:54:29+01:00
-
c98f8fdb
by Duncan Coutts at 2026-06-18T23:55:21+01:00
4 changed files:
- libraries/ghc-internal/src/GHC/Internal/Event/Control.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Manager.hs
- libraries/ghc-internal/src/GHC/Internal/Event/TimerManager.hs
- rts/win32/AsyncMIO.h
Changes:
| ... | ... | @@ -39,7 +39,7 @@ import GHC.Internal.Show (Show) |
| 39 | 39 | import GHC.Internal.Types (Bool(..), Int, IO)
|
| 40 | 40 | import GHC.Internal.Word (Word8)
|
| 41 | 41 | import GHC.Internal.Foreign.C.Error (throwErrnoIfMinus1_, throwErrno, getErrno)
|
| 42 | -import GHC.Internal.Foreign.C.Types (CInt(..), CSize(..))
|
|
| 42 | +import GHC.Internal.Foreign.C.Types (CSize(..))
|
|
| 43 | 43 | import GHC.Internal.Foreign.ForeignPtr (ForeignPtr, mallocForeignPtrBytes, withForeignPtr)
|
| 44 | 44 | import GHC.Internal.Foreign.Marshal.Alloc (alloca, allocaBytes)
|
| 45 | 45 | import GHC.Internal.Foreign.Marshal.Array (allocaArray)
|
| ... | ... | @@ -94,8 +94,8 @@ wakeupReadFd = controlEventFd |
| 94 | 94 | |
| 95 | 95 | -- | Create the structure (usually a pipe) used for waking up the IO
|
| 96 | 96 | -- manager thread from another thread.
|
| 97 | -newControl :: Bool -> IO Control
|
|
| 98 | -newControl shouldRegister = allocaArray 2 $ \fds -> do
|
|
| 97 | +newControl :: IO Control
|
|
| 98 | +newControl = allocaArray 2 $ \fds -> do
|
|
| 99 | 99 | let createPipe = do
|
| 100 | 100 | throwErrnoIfMinus1_ "pipe" $ c_pipe fds
|
| 101 | 101 | rd <- peekElemOff fds 0
|
| ... | ... | @@ -194,7 +194,7 @@ newWith :: Backend -> IO EventManager |
| 194 | 194 | newWith be = do
|
| 195 | 195 | iofds <- fmap (listArray (0, callbackArraySize-1)) $
|
| 196 | 196 | replicateM callbackArraySize (newMVar =<< IT.new 8)
|
| 197 | - ctrl <- newControl False
|
|
| 197 | + ctrl <- newControl
|
|
| 198 | 198 | state <- newIORef Created
|
| 199 | 199 | us <- newSource
|
| 200 | 200 | _ <- mkWeakIORef state $ do
|
| ... | ... | @@ -126,7 +126,7 @@ new = newWith =<< newDefaultBackend |
| 126 | 126 | newWith :: Backend -> IO TimerManager
|
| 127 | 127 | newWith be = do
|
| 128 | 128 | timeouts <- newIORef Q.empty
|
| 129 | - ctrl <- newControl True
|
|
| 129 | + ctrl <- newControl
|
|
| 130 | 130 | state <- newIORef Created
|
| 131 | 131 | us <- newSource
|
| 132 | 132 | _ <- mkWeakIORef state $ do
|
| ... | ... | @@ -25,7 +25,7 @@ extern unsigned int addDoProcRequest(void* proc, void* param); |
| 25 | 25 | extern int startupAsyncIO(void);
|
| 26 | 26 | extern void shutdownAsyncIO(bool wait_threads);
|
| 27 | 27 | |
| 28 | -extern int awaitRequests(bool wait);
|
|
| 28 | +extern bool awaitRequests(bool wait);
|
|
| 29 | 29 | |
| 30 | 30 | extern void abandonRequestWait(void);
|
| 31 | 31 | extern void resetAbandonRequestWait(void);
|