lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
***BOGO*** Re: more mainloops in more threads?
- Date: Tue, 01 Apr 2008 23:33:53 +0100
- From: Chris Vine <chris@xxxxxxxxxxxxxxxxxxxxx>
- Subject: ***BOGO*** Re: more mainloops in more threads?
On Tue, 2008-04-01 at 23:17 +0200, Roberto -MadBob- Guido wrote:
> And, as I can understand, there is no way to manage different lists of
> handlers for different contexts (say: for different threads).
>
> I think Glib will need some low level revisions to match requirements for near
> future computation models...
You understand wrongly. You can have a separate glib main loop for any
thread, if you want.
Start the thread, get a GMainContext object (g_main_context_new()),
create a new GMainLoop with that context (g_main_loop_new()) and then
run the loop in that thread (g_main_loop_run()).
You can create main loop sources with g_idle_source_new(),
g_timeout_source_new(), g_child_watch_source_new() or a custom GSource
object and attach it to the GMainContext object you created, and it will
run in that thread.
glib is thread safe provide that you have called g_thread_init() first.
Read the documentation at
http://library.gnome.org/devel/glib/stable/glib-The-Main-Event-Loop.html
Chris
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list