base-4.12.0.0: Basic libraries

Safe HaskellTrustworthy
LanguageHaskell2010

GHC.Event

Contents

Description

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

This module should be considered GHC internal.

  • ---------------------------------------------------------------------------
Synopsis

Types

data EventManager #

The event manager state.

data TimerManager #

The event manager state.

Creation

getSystemEventManager :: IO (Maybe EventManager) #

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.

new :: IO EventManager #

Create a new event manager.

Registering interest in I/O events

data Event #

An I/O event.

Instances
Eq Event #

Since: base-4.4.0.0

Instance details

Defined in GHC.Event.Internal

Methods

(==) :: Event -> Event -> Bool Source #

(/=) :: Event -> Event -> Bool Source #

Show Event #

Since: base-4.4.0.0

Instance details

Defined in GHC.Event.Internal

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

Semigroup Event #

Since: base-4.10.0.0

Instance details

Defined in GHC.Event.Internal

Methods

(<>) :: Event -> Event -> Event #

sconcat :: NonEmpty Event -> Event #

stimes :: Integral b => b -> Event -> Event #

Monoid Event #

Since: base-4.4.0.0

Instance details

Defined in GHC.Event.Internal

Methods

mempty :: Event #

mappend :: Event -> Event -> Event #

mconcat :: [Event] -> Event #

evtRead :: Event #

Data is available to be read.

evtWrite :: Event #

The file descriptor is ready to accept a write.

type IOCallback = FdKey -> Event -> IO () #

Callback invoked on I/O events.

data FdKey #

A file descriptor registration cookie.

Instances
Eq FdKey #

Since: base-4.4.0.0

Instance details

Defined in GHC.Event.Manager

Methods

(==) :: FdKey -> FdKey -> Bool Source #

(/=) :: FdKey -> FdKey -> Bool Source #

Show FdKey #

Since: base-4.4.0.0

Instance details

Defined in GHC.Event.Manager

Methods

showsPrec :: Int -> FdKey -> ShowS #

show :: FdKey -> String #

showList :: [FdKey] -> ShowS #

data Lifetime #

The lifetime of an event registration.

Since: base-4.8.1.0

Constructors

OneShot

the registration will be active for only one event

MultiShot

the registration will trigger multiple times

Instances
Eq Lifetime #

Since: base-4.8.1.0

Instance details

Defined in GHC.Event.Internal

Show Lifetime #

Since: base-4.8.1.0

Instance details

Defined in GHC.Event.Internal

Semigroup Lifetime #

Since: base-4.10.0.0

Instance details

Defined in GHC.Event.Internal

Monoid Lifetime #

mappend takes the longer of two lifetimes.

Since: base-4.8.0.0

Instance details

Defined in GHC.Event.Internal

registerFd :: EventManager -> IOCallback -> Fd -> Event -> Lifetime -> IO FdKey #

registerFd mgr cb fd evs lt registers interest in the events evs on the file descriptor fd for lifetime lt. cb is called for each event that occurs. Returns a cookie that can be handed to unregisterFd.

unregisterFd :: EventManager -> FdKey -> IO () #

Drop a previous file descriptor registration.

unregisterFd_ :: EventManager -> FdKey -> IO Bool #

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

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

Close a file descriptor in a race-safe way.

Registering interest in timeout events

type TimeoutCallback = IO () #

Callback invoked on timeout events.

data TimeoutKey #

A timeout registration cookie.

Instances
Eq TimeoutKey #

Since: base-4.7.0.0

Instance details

Defined in GHC.Event.TimerManager

registerTimeout :: TimerManager -> Int -> TimeoutCallback -> IO TimeoutKey #

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.

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

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

unregisterTimeout :: TimerManager -> TimeoutKey -> IO () #

Unregister an active timeout.