| Copyright | (c) The University of Glasgow 2017 |
|---|---|
| License | see libraries/base/LICENSE |
| Maintainer | [email protected] |
| Stability | internal |
| Portability | non-portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
The IoSubSystem control interface. These methods can be used to disambiguate between the two operations.
The API of this module is unstable and not meant to be consumed by the general public. If you absolutely must depend on it, make sure to use a tight upper bound, e.g., base < 4.X rather than base < 5, because the interface can change rapidly without much warning.
withIoSubSystem :: (IoSubSystem -> IO a) -> IO a Source
withIoSubSystem' :: (IoSubSystem -> a) -> a Source
whenIoSubSystem :: IoSubSystem -> IO () -> IO () Source
ioSubSystem :: IoSubSystem Source
The IoSubSystem in use.
This is needed to optimize support for different IO Managers on Windows. GHC supports both the new WinIO manager as well as the old MIO (threaded), and ancient win32-legacy (non-threaded) ones. The WinIO manager uses native Win32 HANDLEs, whereas the other two use posix style FDs (via translation layers).
In many places in the I/O base library code, for correctness or performance on Windows, we have to take different code paths depending on which style of IO manager is in use. The IO manager is set on RTS startup (and the default choice can be overridden using RTS flags). On Windows this value is obtained by reading a global variable that is set by the RTS IOManager on startup.
On non-Windows systems this value is always IoPOSIX.
data IoSubSystem Source
The I/O SubSystem to use in the program.
Since: base-4.9.0.0
| IoPOSIX | Use a POSIX I/O Sub-System |
| IoNative | Use platform native Sub-System. For unix OSes this is the same as IoPOSIX, but on Windows this means use the Windows native APIs for I/O, including IOCP and RIO. |
| Enum IoSubSystem Source | |
Defined in GHC.Internal.IO.SubSystem Methodssucc :: IoSubSystem -> IoSubSystem Source pred :: IoSubSystem -> IoSubSystem Source toEnum :: Int -> IoSubSystem Source fromEnum :: IoSubSystem -> Int Source enumFrom :: IoSubSystem -> [IoSubSystem] Source enumFromThen :: IoSubSystem -> IoSubSystem -> [IoSubSystem] Source enumFromTo :: IoSubSystem -> IoSubSystem -> [IoSubSystem] Source enumFromThenTo :: IoSubSystem -> IoSubSystem -> IoSubSystem -> [IoSubSystem] Source | |
| Show IoSubSystem Source | |
Defined in GHC.Internal.IO.SubSystem MethodsshowsPrec :: Int -> IoSubSystem -> ShowS Source show :: IoSubSystem -> String Source showList :: [IoSubSystem] -> ShowS Source | |
| Eq IoSubSystem Source | |
Defined in GHC.Internal.IO.SubSystem Methods(==) :: IoSubSystem -> IoSubSystem -> Bool Source (/=) :: IoSubSystem -> IoSubSystem -> Bool Source | |
conditional :: a -> a -> a Source
Conditionally execute an action depending on the configured I/O subsystem. On POSIX systems always execute the first action. On Windows execute the second action if WINIO as active, otherwise fall back to the first action.
(<!>) :: a -> a -> a infixl 7 Source
Infix version of conditional. posix ! windows == conditional posix windows
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/9.12.1/docs/libraries/base-4.21.0.0-8e62/GHC-IO-SubSystem.html