W3cubDocs

/Haskell 8

GHC.Event

Safe Haskell Trustworthy
Language Haskell2010

Description

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

This module should be considered GHC internal.

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

Types

data EventManager Source

The event manager state.

data TimerManager Source

The event manager state.

Creation

getSystemEventManager :: IO (Maybe EventManager) Source

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 Source

Create a new event manager.

getSystemTimerManager :: IO TimerManager Source

Registering interest in I/O events

data Event Source

An I/O event.

Instances

Eq Event

Methods

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

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

Show Event

Since: 4.3.1.0

Semigroup Event

Since: 4.10.0.0

Monoid Event

Since: 4.3.1.0

evtRead :: Event Source

Data is available to be read.

evtWrite :: Event Source

The file descriptor is ready to accept a write.

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

Callback invoked on I/O events.

data FdKey Source

A file descriptor registration cookie.

Instances

data Lifetime Source

The lifetime of an event registration.

Since: 4.8.1.0

Constructors

OneShot

the registration will be active for only one event

MultiShot

the registration will trigger multiple times

Instances

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

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 () Source

Drop a previous file descriptor registration.

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

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 () Source

Close a file descriptor in a race-safe way.

Registering interest in timeout events

type TimeoutCallback = IO () Source

Callback invoked on timeout events.

data TimeoutKey Source

A timeout registration cookie.

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

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 () Source

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

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

Unregister an active timeout.

© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.2.1/docs/html/libraries/base-4.10.0.0/GHC-Event.html