Re: Keeping program flow moving nicely



gtk_timeout_add() is not supposed to be accurate or anything. Every 100
milliseconds the main loop will try to add the callback to the
event-list, but if the program is busy, it'll just wait until the next
100th millisecond. So, you can't be guaranteed that the callback will be
called the full number of times.

    = L

On 10 Feb 2001 16:34:44 -0800, Eric M. Monsler wrote:
> 
> 
> "Timothy M. Shead" wrote:
> > 
> (snip)
> > Use gtk_timeout_add() to create a 'timeout' signal that gets called,
> > say, every 100 milliseconds or so.  In your handler for the timeout
> > event you decide whose turn it is and call process_move().  
> 
> What is the gtk behavior in this situation, if it takes more than 100 ms
> to do process_move()?  I have no idea if this game does so, but I'm
> curious what would happen.  
> 
> Some frameworks promise that a periodic callback function will get
> called the correct number of times, even if the callback (or other code)
> causes them to occur far later than they ought.  In those situations, if
> the periodic callback does not have sufficient state awareness to either
> deinstall future calls, or do a quick-return, the result could be
> disastrous (or, in this case, a UI lockup identical to the initial
> problem).



/-------------------------------------------------------------------\
|   LOBAN AMAAN RAHMAN  <-- anagram of -->  AHA! AN ABNORMAL MAN!   |
|     loban earthling net, loban caltech edu, http://i.am/loban     |
\-------------------------------------------------------------------/





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