[DGD] call_out question

Stephen Schmidt schmidsj at union.edu
Sun Jul 14 20:17:53 CEST 2002


On Sun, 14 Jul 2002, Jay Shaffstall wrote:
> 1) If I use call_out with a delay of 0, the docs say that the function "is
> to be called as soon as possible after termination of the current
> thread".  If input from users has been waiting, will it all be processed
> before the call_out?  Can a call_out be starved if users continue to send
> input?

I do not know, but the existence of the second question suggests
to me that the answer to the first is "no".

> 2) The docs also say "The returned value is the callout handle, an
> integer > 0 which must be used if the callout is to be removed".  I'm not
> sure under what circumstances I should remove a call_out.  I'm assuming a
> call_out only happens once, unless inside it I do another call_out.  When
> should a call_out be removed?

Bogus fantasy adventure game example follows.

Consider a player character with a heartbeat which regularly
restores his hit points when it they are less than maximum.
Now let the player drink a healing potion which instantly
brings him up to full health. At this time one would want to
remove the next call_out to the heartbeat, because it is
not needed anymore.

More generally, when one is using a chain of call_outs for some
sort of background maintenance or monitoring, and the need for
it goes away (other than through the destruction of the object
in question) then one would remove the call_out to stop the
chain.

I'm sure many other examples are possible, but this is the first
thing that came to my mind.

Steve


_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list