Main Page Widgets glibmm Namespaces Book

# The Main Event Loop

Manages all available sources of events. More...

## Classes
class | Glib::PollFD
class | Glib::SignalTimeout
class | Glib::SignalIdle
class | Glib::SignalIO
class | Glib::SignalChildWatch
class | Glib::MainContext
| Main context. More...
class | Glib::MainLoop
class | Glib::Source
class | Glib::TimeoutSource
class | Glib::IdleSource
class | Glib::IOSource
## Enumerations
enum | { Glib::PRIORITY_HIGH = -100, Glib::PRIORITY_DEFAULT = 0, Glib::PRIORITY_HIGH_IDLE = 100, Glib::PRIORITY_DEFAULT_IDLE = 200, Glib::PRIORITY_LOW = 300 }
enum | Glib::IOCondition { Glib::IO_IN, Glib::IO_OUT, Glib::IO_PRI, Glib::IO_ERR, Glib::IO_HUP, Glib::IO_NVAL }
| A bitwise combination representing an I/O condition to watch for on an event source. More...
## Functions
IOCondition | Glib::operator| (IOCondition lhs, IOCondition rhs)
IOCondition | Glib::operator& (IOCondition lhs, IOCondition rhs)
IOCondition | Glib::operator^ (IOCondition lhs, IOCondition rhs)
IOCondition | Glib::operator~ (IOCondition flags)
IOCondition& | Glib::operator|= (IOCondition& lhs, IOCondition rhs)
IOCondition& | Glib::operator&= (IOCondition& lhs, IOCondition rhs)
IOCondition& | Glib::operator^= (IOCondition& lhs, IOCondition rhs)
SignalTimeout | Glib::signal_timeout ()
| Convenience timeout signal.
SignalIdle | Glib::signal_idle ()
| Convenience idle signal.
SignalIO | Glib::signal_io ()
| Convenience I/O signal.
SignalChildWatch | Glib::signal_child_watch ()
| Convenience child watch signal.
Glib::RefPtr<MainContext> | Glib::MainContext::wrap (GMainContext* gobject, bool take_copy=false)
Glib::RefPtr<MainLoop> | Glib::MainLoop::wrap (GMainLoop* gobject, bool take_copy=false)

## Detailed Description

Manages all available sources of events.

## Enumeration Type Documentation

anonymous enum

Enumerator:

  PRIORITY_HIGH | Use this for high priority event sources. It is not used within GLib or GTK+.
  PRIORITY_DEFAULT | Use this for default priority event sources. In glibmm this priority is used by default when installing timeout handlers with SignalTimeout::connect(). In GDK this priority is used for events from the X server.
  PRIORITY_HIGH_IDLE | Use this for high priority idle functions. GTK+ uses `PRIORITY_HIGH_IDLE + 10` for resizing operations, and `PRIORITY_HIGH_IDLE + 20` for redrawing operations. (This is done to ensure that any pending resizes are processed before any pending redraws, so that widgets are not redrawn twice unnecessarily.)
  PRIORITY_DEFAULT_IDLE | Use this for default priority idle functions. In glibmm this priority is used by default when installing idle handlers with SignalIdle::connect().
  PRIORITY_LOW | Use this for very low priority background tasks. It is not used within GLib or GTK+.

enum Glib::IOCondition

A bitwise combination representing an I/O condition to watch for on an event source.

The flags correspond to those used by the `poll()` system call on UNIX (see `man 2 poll`). To test for individual flags, do something like this:

     if((condition & Glib::IO_OUT) != 0)
       do_some_output();

Bitwise operators:
  `IOCondition operator|(IOCondition, IOCondition)`
  `IOCondition operator&(IOCondition, IOCondition)`
  `IOCondition operator^(IOCondition, IOCondition)`
  `IOCondition operator~(IOCondition)`
  `IOCondition& operator|=(IOCondition&, IOCondition)`
  `IOCondition& operator&=(IOCondition&, IOCondition)`
  `IOCondition& operator^=(IOCondition&, IOCondition)`

Enumerator:

  IO_IN | There is data to read.
  IO_OUT | Data can be written (without blocking).
  IO_PRI | There is urgent data to read.
  IO_ERR | Error condition.
  IO_HUP | Hung up (the connection has been broken, usually for pipes and sockets).
  IO_NVAL | Invalid request. The file descriptor is not open.

## Function Documentation

IOCondition Glib::operator & | ( | IOCondition | lhs,
|  | IOCondition | rhs |
| ) |  |  | `[inline]`

IOCondition& Glib::operator &= | ( | IOCondition & | lhs,
|  | IOCondition | rhs |
| ) |  |  | `[inline]`

IOCondition Glib::operator^ | ( | IOCondition | lhs,
|  | IOCondition | rhs |
| ) |  |  | `[inline]`

IOCondition& Glib::operator^= | ( | IOCondition & | lhs,
|  | IOCondition | rhs |
| ) |  |  | `[inline]`

IOCondition Glib::operator| | ( | IOCondition | lhs,
|  | IOCondition | rhs |
| ) |  |  | `[inline]`

IOCondition& Glib::operator|= | ( | IOCondition & | lhs,
|  | IOCondition | rhs |
| ) |  |  | `[inline]`

IOCondition Glib::operator~ | ( | IOCondition | flags | ) | `[inline]`

SignalChildWatch Glib::signal_child_watch | ( |  | ) |

Convenience child watch signal.

Returns:
  A signal proxy; you want to use SignalChildWatch::connect().

SignalIdle Glib::signal_idle | ( |  | ) |

Convenience idle signal.

Returns:
  A signal proxy; you want to use SignalIdle::connect().

Examples:
  thread/dispatcher.cc.

SignalIO Glib::signal_io | ( |  | ) |

Convenience I/O signal.

Returns:
  A signal proxy; you want to use SignalIO::connect().

SignalTimeout Glib::signal_timeout | ( |  | ) |

Convenience timeout signal.

Returns:
  A signal proxy; you want to use SignalTimeout::connect().

Glib::RefPtr<MainLoop> wrap | ( | GMainLoop * | gobject,
|  | bool | take_copy = `false` |
| ) |  |  | `[related, inherited]`

Glib::RefPtr<MainContext> wrap | ( | GMainContext * | gobject,
|  | bool | take_copy = `false` |
| ) |  |  | `[related, inherited]`