Re: Possible to use a gtk_timeout without a gtk_main loop
- From: Tristan Van Berkom <tvb gnome org>
- To: "Noonan, Michael (DCOI)" <Michael Noonan Smithsdetection com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Possible to use a gtk_timeout without a gtk_main loop
- Date: Mon, 13 Mar 2006 14:23:41 -0500
Noonan, Michael (DCOI) wrote:
Hi Folks,
I was wondering would it be possible to have a gtk_timer running outside of the gtk_main loop. I have a separate process that needs to interact with a Gtk application every n seconds and I was wondering if I could set a gtk_timer using gtk_timeout_add() outside the gtk_main() loop.
Its g_timeout_add(); and you can use it in a thread if that
thread is running its own mainloop (i.e. g_mainloop_run());
the thread will need its own GMainContext (be sure to set that
as the context of the GMainLoop for your thread) and you'll need
to use g_timeout_source_new() & g_source_attach().
But typically; I would expect you might want your "worker thread"
to sleep on a command queue; and issue commands to that thread
every "timout" from the main thread.
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]