Phantasmal MUD Lib for DGD

Phantasmal Site > DGD > DGD LPC Reference > call_out

Using call_out()

From: dgd at list.imaginary.com (Felix A. Croes)
Date: Fri Feb 21 21:47:01 2003
Subject: [DGD] call_out delay

Jay Shaffstall wrote:

> I'm using call_out with a delay to trigger events in my mud that need to 
> happen at specific intervals.  The call_out docs say, "If the delay is an 
> integer, the function will be called after approximately the specified 
> number of seconds".

DGD handles timing for integer-delay callouts using the POSIX time.
That means that a one-second callout started at time T will be executed
(the rest of the MUD allowing) when the time turns into T+1, measured
in POSIX seconds since 1970.  So the actual delay can be between 0 and 1
seconds, and that's ignoring delays due to other callouts trying to
run at that same moment.

For callouts with a floating point delay, more care is taken that they
run precisely at the intended moment.  A 1.0 delay callout started at
T + 0.23 will be executed at T + 1.23.


> How approximate is approximate?  On my Windows PC, things seem to work as 
> I'd expect.  One of my builders is using a Linux laptop, and has seen the 
> delays decrease until events are being fired continually (the actual value 
> being passed in for the delay hasn't changed).  However on his Linux PC, it 
> seems to work fine.

This may legitimately (appear to) happen if each one second callout takes
.95 seconds to process.  Perhaps the laptop is fairly old, and a lot
slower than the desktop machine?  Otherwise, this may be a bug in DGD
which I would like to learn more about.

Regards,
Dworkin

From: dgd at list.imaginary.com (Erwin Harte)
Date: Sat Mar 15 19:30:02 2003
Subject: [DGD] Skills

On Sat, Mar 15, 2003 at 08:25:44PM -0500, Ben Chambers wrote:
> If you put a call_out with a time of 0, will it be executed during this loop
> of execution or during the next loop of execution?

As soon as possible after the current thread ends.  Having it execute
_during_ this loop of execution (thread) would make it a call_other()
effectively, which wouldn't be very useful.

The only thing that could cause the 0-call_out not to be execute
right after the current thread is if there are other 0-callouts
waiting to be executed.

Hope that helps,

Erwin.
-- 
Erwin Harte

From: dgd at list.imaginary.com (Erwin Harte)
Date: Tue Nov  6 10:59:01 2001
Subject: [DGD] call_outs to destructed objects

On Tue, Nov 06, 2001 at 04:07:31PM +0000, Soja wrote:
> 
> Hi !
> I wonder if it is a good thing to remove all call_outs you know are 
> directed to a specific object, before you destruct the object?
> Or is it taken care of by the dest function?  Or is it just not necessary,
> as the call_out will die by itself when it has nothing to call?

All call_out()s started in object A are removed from the system
automatically when object A is destroyed.

Erwin.
-- 
Erwin Harte

From: dgd@dworkin.nl (Felix A. Croes)
Date: Tue Apr  5 19:12:02 2005
Subject: [DGD] call_outs

Steve Wooster wrote:

>      Yet another question occurred to me... I've heard that if you do a 
> call_out for 3 seconds, and one for 5, the 3 second call_out is guaranteed 
> to execute before the 5 second one... What about if you do a 5 second 
> call_out, and a bunch of chained 0-second call_outs... Is there any 
> guarantee that the 5 second call_out will be executed after the last 0 
> second one? (or is it only guaranteed to execute after the first 0 second 
> call_out?) Thanks!

The 5 second callout might execute after the first zero second callout
and before the second one.

If you want to be certain that the chain of zero second callouts comes
first, start the 5 second callout from the last one.

Regards,
Dworkin