HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-internal-9.1003.0Haskell2010

GHC.Internal.Event

This module provides scalable event notification for file descriptors and timeouts.

This module should be considered GHC internal.

  • ---------------------------------------------------------------------------

  • 8 types
  • 13 values

Types

2 declarations

Creation

3 declarations

Retrieve the system event manager for the capability on which the calling thread is running.

This function always returns Just the current thread's event manager when using the threaded RTS and Nothing otherwise.

Registering interest in I/O events

11 declarations
newtypenewtype Event
#

An I/O event.

Instances4Eq, Show, Semigroup, Monoid
  • Eq EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.Types
  • Show EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.Types
  • Semigroup EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.Types
  • Monoid EventDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.Types
valueevtWrite :: Event
#

The file descriptor is ready to accept a write.

datadata FdKey
#

A file descriptor registration cookie.

Instances2Eq, Show
  • Eq FdKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Manager
  • Show FdKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Manager
datadata Lifetime
#

The lifetime of an event registration.

Constructors

  • OneShot

    the registration will be active for only one event

  • MultiShot

    the registration will trigger multiple times

Instances4Eq, Show, Semigroup, Monoid
  • Eq LifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.Types
  • Show LifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.Types
  • Semigroup LifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.Types
  • Monoid LifetimeDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.Internal.Types

    mappend takes the longer of two lifetimes.

Drop a previous file descriptor registration, without waking the event manager thread. The return value indicates whether the event manager ought to be woken.

valuecloseFd :: EventManager -> (Fd -> IO ()) -> Fd -> IO ()
#

Close a file descriptor in a race-safe way. It might block, although for a very short time; and thus it is interruptible by asynchronous exceptions.

Registering interest in timeout events

5 declarations
typetype TimeoutCallback = IO ()
#

Warning: since the TimeoutCallback is called from the I/O manager, it must not throw an exception or block for a long period of time. In particular, be wary of throwTo and Control.Concurrent.killThread: if the target thread is making a foreign call, these functions will block until the call completes.

newtypenewtype TimeoutKey
#

A timeout registration cookie.

Instances2Eq, Ord
  • Eq TimeoutKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.TimeOut
  • Ord TimeoutKeyDefined in ghc-internal-9.1003.0 · GHC.Internal.Event.TimeOut

Register a timeout in the given number of microseconds. The returned TimeoutKey can be used to later unregister or update the timeout. The timeout is automatically unregistered after the given time has passed.

Be careful not to exceed maxBound :: Int, which on 32-bit machines is only 2147483647 μs, less than 36 minutes.

valueupdateTimeout :: TimerManager -> TimeoutKey -> Int -> IO ()
#

Update an active timeout to fire in the given number of microseconds.

Be careful not to exceed maxBound :: Int, which on 32-bit machines is only 2147483647 μs, less than 36 minutes.