Main Event Loop and Thread.



Hi Everyone:

 I am a bit lost concerning the usage of the relationship between Main event loop and thread in Glib.

 If I use g_timeout_add_full in some callback function ,will it start a "thread" to do it ? Or just add a new "source" to be handled by 
 main event loop without thread?  

 What's the relationship with thread , source  and main event loop ?
 How should I understand these comments ?
"

The main event loop manages all the available sources of events for GLib and GTK+ applications. These events can come from any number of different types of sources such as file descriptors (plain files, pipes or sockets) and timeouts. New types of event sources can also be added using g_source_attach().

To allow multiple independent sets of sources to be handled in different threads, each source is associated with a GMainContext. A GMainContext can only be running in a single thread, but sources can be added to it and removed from it from other threads.

"


 Thanks a lot!
 grassroot
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]