Re: Main Event Loop and Thread.

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

 



A similar question has been discussed earlier in this list starting with 
this post:
http://mail.gnome.org/archives/gtk-list/2007-October/msg00003.html

>  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?

It will not start a new thread. It will attach a new source (a 
timeout-source) to the default main context. The default main context 
will be handled by the thread which runs a main loop for the default 
main context, for instance like this:

  GMainLoop *ml;
  ml = g_main_loop_new(NULL, FALSE); // NULL means default context
  g_main_loop_run(ml);

(In my understanding there is exactly one _default_ main context per 
process - please fix me if I am wrong..)

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

In the thread above, the following post may answer your question:
http://mail.gnome.org/archives/gtk-list/2007-October/msg00015.html


Hope this helps..


Cheers,
Oben
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux