Re: Recalculation of timeouts with g_timeout_add



2008/5/16 Mitko Haralanov <mitko qlogic com>:
 I am not sure why the GTK devs decided that re-calculating the timeout
 based on the time right after the timeout thread is started is the
 right thing to do but it seems very wrong to me.

I think the idea is that the timeout might represent a counter. If you
set a 1s timeout, you can expect that after 5 calls (for example)
about 5s will have passed.

 What if the timeout function takes longer then the timeout itself? You
 end up with multiple threads running the timeout function at the same
 time.

No, glib never runs more than one callback at once. They will just
queue up and run when the mainloop becomes idle again.

John



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