glibmm 2.46.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Glib::MainLoop Class Reference
The Main Event Loop

`#include <glibmm/main.h>`

## Public Types

typedef Glib::MainLoop | CppObjectType
typedef GMainLoop | BaseObjectType

## Public Member Functions

void | run ()
| Runs a main loop until quit() is called on the loop. More...
void | quit ()
| Stops a MainLoop from running. More...
bool | is_running ()
| Checks to see if the main loop is currently being run via run(). More...
Glib::RefPtr< MainContext > | get_context ()
| Returns the MainContext of loop. More...
void | reference () const
| Increases the reference count on a MainLoop object by one. More...
void | unreference () const
| Decreases the reference count on a MainLoop object by one. More...
GMainLoop* | gobj ()
const GMainLoop* | gobj () const
GMainLoop* | gobj_copy () const

## Static Public Member Functions

static Glib::RefPtr< MainLoop > | create (bool is_running=false)
static Glib::RefPtr< MainLoop > | create (const Glib::RefPtr< MainContext >& context, bool is_running=false)
static int | depth ()

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< MainLoop > | wrap (GMainLoop* gobject, bool take_copy=false)

## Member Typedef Documentation

typedef GMainLoop Glib::MainLoop::BaseObjectType

typedef Glib::MainLoop Glib::MainLoop::CppObjectType

## Member Function Documentation

static Glib::RefPtr<MainLoop> Glib::MainLoop::create | ( | bool | is_running = `false` | ) |

static

Examples:
  thread/dispatcher.cc.

static Glib::RefPtr<MainLoop> Glib::MainLoop::create | ( | const Glib::RefPtr< MainContext >& | context,
|  | bool | is_running = `false`
| ) |  |

static

static int Glib::MainLoop::depth | ( |  | ) |

static

Glib::RefPtr<MainContext> Glib::MainLoop::get_context | ( |  | ) |

Returns the MainContext of loop.

Returns
  The MainContext of loop.

GMainLoop* Glib::MainLoop::gobj | ( |  | ) |

const GMainLoop* Glib::MainLoop::gobj | ( |  | ) | const

GMainLoop* Glib::MainLoop::gobj_copy | ( |  | ) | const

bool Glib::MainLoop::is_running | ( |  | ) |

Checks to see if the main loop is currently being run via run().

Returns
  true if the mainloop is currently being run.

void Glib::MainLoop::quit | ( |  | ) |

Stops a MainLoop from running.

Any calls to run() for the loop will return.

void Glib::MainLoop::reference | ( |  | ) | const

Increases the reference count on a MainLoop object by one.

void Glib::MainLoop::run | ( |  | ) |

Runs a main loop until quit() is called on the loop.

If this is called for the thread of the loop's MainContext, it will process events from the loop, otherwise it will simply wait.

void Glib::MainLoop::unreference | ( |  | ) | const

Decreases the reference count on a MainLoop object by one.

If the result is zero, free the loop and free all associated memory.