• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Glibmm Main Event Loop

 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to understand and use Glibmm Main Event Loop. I find it difficult to understand what it actually do.
A program that wants to use the Main Event Loop first defines it like this:
Glib::RefPtr<Glib::MainLoop> _mainloop;

Then the constructor creates it like this:
Application::Application () :
_mainloop (Glib::MainLoop::create())
{...}

The application must implement a run function where it calls on mainloop->run().
void
Application::run()
{
_mainloop->run();
}

Now: What exactly is it its doing?
I have read http://en.wikipedia.org/wiki/Event_loop, but I am still lost, don't know why. Maybe I need a dumbed down explanation...
I have also tried to understand the following example: http://developer.gnome.org/glibmm/unstable/thread_2dispatcher_8cc-example.html#a15
From Java I am familiar with event listeners that listens for specific events. Don't know if this is similar.

Anyway from this code I cannot see what the mainloop actually does for this Application...
 
Anand Hariharan
Rancher
Posts: 272
C++ Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glibmm is a C++ wrapper for GLib's GObjects.

To understand Glibmm's Main Event Loop, you may want to read Glib's documentation of Main Event Loop: http://developer.gnome.org/glib/2.32/glib-The-Main-Event-Loop.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic