Re: Periodic and cross platform timers or alarms
- From: Ben Johnson <ben blarg net>
- To: gtk-list gnome org
- Subject: Re: Periodic and cross platform timers or alarms
- Date: Wed, 10 Aug 2005 14:07:37 -0700
On Wed, Aug 10, 2005 at 02:34:22PM -0500, Douglas Vechinski wrote:
> Thanks for the info but you now made me think of another question.
>
> While in the callback, if I determine that I need to perform a task that
> could "take a while", do I need to be worried that the alarm or signal
> could be called again. If so, is there a way to suspend it so it
> won't be called again until I finish with the current callback or do I
> need to use a g_source_remove and then before I return do another
> g_timeout_add.
you may wish to rtfm a little more carefully.
http://www.gtk.org/api/2.6/glib/glib-The-Main-Event-Loop.html#g-timeout-add
"After each call to the timeout function, the time of the next timeout
is recalculated based on the current time and the given interval (it
does not try to 'catch up' time lost in delays)."
I take that to mean the next interval is started after your callback
returns. so, you if have an interval of 40 seconds and a callback that
takes 3 years to run, your callback will be called at most every 3 years
and 40 seconds.
- Ben
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]