-
September 12th, 2012, 05:32 AM
#1
Using Glibmm Main Event Loop
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:
Code:
Glib::RefPtr<Glib::MainLoop> _mainloop;
Then the constructor creates it like this:
Code:
Application::Application () :
_mainloop (Glib::MainLoop::create())
{...}
The application must implement a run function where it calls on mainloop->run().
Code:
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_...ispatcher_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...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|