Hi Chris, Got it. That really eases programming. Thanks a lot! Gang 2011/6/22 Chris Vine <chris@xxxxxxxxxxxxxxxxxxxxx>: > On Wed, 22 Jun 2011 08:44:41 +0800 > Gang Chen <gang.chen.cn@xxxxxxxxx> wrote: >> The reference says, "The changed signal will be emitted in the >> thread-default main context of the thread that the monitor was created >> in." Then if I create a file monitor in a background thread, is it >> necessary to enter the event loop in that thread in order to catch the >> changed signal? My background thread is mainly used to carry out >> background tasks. I don't want to use an event loop in it. Any ideas? > > As far as I understand it, a thread's default main context for gio's > purposes is the global default context (the main thread's context), > unless you set it to be different with g_main_context_push_thread_default(). > You can only of course do that if more than one thread has a main loop. > This should tell you what you want: > > http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-main-context-push-thread-default > > The point is that glib's non-gio main loop functions require you to > pass a non-default context to g_source_attach() when inserting a new > source into the main loop, if you want it to execute in other than the > main program thread. However, in the case of gio's main loop functions > (eg asynchronous io and file operations), it has to be done by pushing > (and if need be popping) the thread's context onto gio's thread context > stack. Somewhat confusing I agree. > > Chris > > > _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list