Gtk2HsContentsIndex
System.Glib.MainLoop
Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users@lists.sourceforge.net
Description
main event loop, and events
Synopsis
type HandlerId = CUInt
timeoutAdd :: IO Bool -> Int -> IO HandlerId
timeoutAddFull :: IO Bool -> Priority -> Int -> IO HandlerId
timeoutRemove :: HandlerId -> IO ()
idleAdd :: IO Bool -> Priority -> IO HandlerId
idleRemove :: HandlerId -> IO ()
data IOCondition
= IOIn
| IOOut
| IOPri
| IOErr
| IOHup
| IOInvalid
inputAdd :: FD -> [IOCondition] -> Priority -> IO Bool -> IO HandlerId
inputRemove :: HandlerId -> IO ()
type Priority = Int
priorityLow :: Int
priorityDefaultIdle :: Int
priorityHighIdle :: Int
priorityDefault :: Int
priorityHigh :: Int
Documentation
type HandlerId = CUInt
timeoutAdd :: IO Bool -> Int -> IO HandlerId

Sets a function to be called at regular intervals, with the default priority priorityDefault. The function is called repeatedly until it returns False, after which point the timeout function will not be called again. The first call to the function will be at the end of the first interval.

Note that timeout functions may be delayed, due to the processing of other event sources. Thus they should not be relied on for precise timing. After each call to the timeout function, the time of the next timeout is recalculated based on the current time and the given interval (it does not try to 'catch up' time lost in delays).

timeoutAddFull :: IO Bool -> Priority -> Int -> IO HandlerId

Sets a function to be called at regular intervals, with the given priority. The function is called repeatedly until it returns False, after which point the timeout function will not be called again. The first call to the function will be at the end of the first interval.

Note that timeout functions may be delayed, due to the processing of other event sources. Thus they should not be relied on for precise timing. After each call to the timeout function, the time of the next timeout is recalculated based on the current time and the given interval (it does not try to 'catch up' time lost in delays).

timeoutRemove :: HandlerId -> IO ()
Remove a previously added timeout handler by its HandlerId.
idleAdd :: IO Bool -> Priority -> IO HandlerId

Add a callback that is called whenever the system is idle.

  • A priority can be specified via an integer. This should usually be priorityDefaultIdle.
  • If the function returns False it will be removed.
idleRemove :: HandlerId -> IO ()
Remove a previously added idle handler by its HandlerId.
data IOCondition

Flags representing a condition to watch for on a file descriptor.

IOIn
There is data to read. [IOOut] Data can be written (without blocking). [IOPri] There is urgent data to read. [IOErr] Error condition. [IOHup] Hung up (the connection has been broken, usually for pipes and sockets). [IOInvalid] Invalid request. The file descriptor is not open.
Constructors
IOIn
IOOut
IOPri
IOErr
IOHup
IOInvalid
show/hide Instances
inputAdd
:: FDa file descriptor
-> [IOCondition]the condition to watch for
-> Prioritythe priority of the event source
-> IO Boolthe function to call when the condition is satisfied. The function should return False if the event source should be removed.
-> IO HandlerIdthe event source id
Adds the file descriptor into the main event loop with the given priority.
inputRemove :: HandlerId -> IO ()
type Priority = Int
Priorities for installing callbacks.
priorityLow :: Int
priorityDefaultIdle :: Int
priorityHighIdle :: Int
priorityDefault :: Int
priorityHigh :: Int
Produced by Haddock version 0.8