Table of Contents

Module: callout mudlib/callout.py

A callout is a request to have a method invoked after a given time duration (in seconds). The driver guarantees that at least the given time duration will pass before the method is invoked, but makes no guarantee as to when the actual invocation will occur (i.e., if you specify two seconds, at least two seconds will pass, but the invocation won't necessarily happen exactly two seconds later).

As far as the Driver is concerned, all callouts are events. The contract between the Driver and events is such that it's the event's responsibility to set an active object with the Driver during event processing, if an active object will be required by anything within the path of execution initiated by that event.

This module provides convenience functions for requesting callouts from the Driver. You can either supply an instance of your own event that you would like processed after the time duration, or you can supply an active object and a function, in which case this module will submit an instance of its own event to the Driver that, when processed, will set the active object to the one provided and then invoke the given function.

Imported modules   
from org.bluesock.bluemud.driver import Driver
from org.bluesock.bluemud.lib import MudEvent
Functions   
addCallout
addCalloutEvent
  addCallout 
addCallout (
        secondsDelay,
        activeObject,
        method,
        optionalArguments=None,
        )

Requests that a method be invoked after a time delay. The minimum delay before invoking the method (in seconds) must be provided, along with the object to make active prior to method invocation, the method to invoke, and (optionally) an argument to pass to the method.

Note: This guarantees that at least that many seconds will elapse before the callout kicks off, but it's possible that more time may elapse.

arguments:

secondsDelay
(int) the number of seconds from now that the callout should execute.
activeObject
(instance) the object on which the method should be called.
method
(function) the method to call
optionalArguments=None
(tuple) the arguments to pass to the method

  addCalloutEvent 
addCalloutEvent ( secondsDelay,  event )

Request that an event be processed after a time delay. The MudEvent to be processed when the callout is fulfilled must be provided. Note that, like all events, the given event should be careful to set the active object in the Driver if needed.

arguments:

secondsDelay
(int) the number of seconds to wait until executing this event.
event
(mudlib.callout.CalloutEvent) the event to schedule

Classes   
CalloutEvent

Upon processing, sets an active object and invokes a given method.


Table of Contents

This document was automatically generated on Thu Jan 24 08:57:43 2002 by HappyDoc version 2.0