Re: Is GTK multi-threaded by default??



Sai Korada wrote:
Hi,

I'm developing an application using GTK, that talks with device driver.
In this process I've introduced a timer callback, where the timer is set
to 10, and, the callback function transfers some bytes to memory card.
Then it should get the status from the memory card. My question here is,
whether GTK will wait in the callback to read the status or will it call
the callback again as the timer lapses. How can I ensure that the
callback function is called only after the status is read from the
memory card.

  The answer to your subject line is "no", you should read
this text [1] to understand more about what gtk+ does when inside
the gtk_main() function and how event sources work etc, you should
also note that g_timeout_add() isnt intended to be "precise" per se,
and shouldnt be used to ensure an exact timeout in a time critical
application, although I doubt that is really a requirement for
you judging by your email (might be).

Cheers,
                   -Tristan

[1]http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html



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