Re: Forcing a G Timeout to be handled by a specific thread
- From: Chris Vine <chris cvine freeserve co uk>
- To: Andrew Wood <a j w me com>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: Forcing a G Timeout to be handled by a specific thread
- Date: Wed, 5 Oct 2011 19:17:00 +0100
On Wed, 05 Oct 2011 14:00:40 +0100
Andrew Wood <a j w me com> wrote:
Is there a way to ensure a timeout callback set with g_timeout_add is
always executed by a specific pthread?
Timeouts started with g_timeout_add() or g_timeout_add_full() execute
in the default main context, which is normally the main context
of the thread with which the program begins and which first creates a
main loop (as by, for example, calling gtk_main()/g_main_loop_run()).
If you have more than a worker thread with its own main loop and you
want the timeout to execute in the worker thread's main loop, you have
to create a timeout source with g_timeout_source_new() and attach it to
the worker thread's main context with g_source_attach().
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]