Package twisted :: Package python :: Module delay :: Class LockstepSimulation

[show private | hide private]
[frames | no frames]

## Class LockstepSimulation

    Sensitive --+
                |
               LockstepSimulation

I am a delayed event queue.

A delayed event scheduler which, in my humble but correct opinion, is much better and more featureful than the built-in 'sched' module, especially when you're working with event insertions from multiple threads.

Various methods in this class return Stoppable objects; each of these has a single stop() method which will cause the method that created them to be cancelled. In the case of a loop, the loop will be stopped; a series of steps will be stopped in the middle, and a single method call will not be made.

Method Summary
| ``__init__`(self)` Initialize the delayed event queue.
| ``__setstate__`(self, dict)` Delayed.__setstate__(dict) -> None
| ``later`(self, func, ticks, args)` Delayed.later(func [, ticks [, args]]) -> Stoppable
| ``latestVersionOf`(self, anObject)` Get the latest version of an object. (inherited from `Sensitive`)
| ``loop`(self, func, ticks, args)` Delayed.loop(func[, ticks=0][, args=()]) -> Stoppable
| `needRebuildUpdate(self)` (inherited from `Sensitive`)
| `rebuildUpToDate(self)` (inherited from `Sensitive`)
| ``run`(self)` Delayed.run() -> None
| ``runEverything`(self)` Run all currently-pending callbacks.
| ``runloop`(self)` Runs until the is_running flag is false.
| ``runUntilCurrent`(self)` Delayed.runUntilCurrent() -> None
| ``step`(self, func, list, ticks)` Delayed.step(func,list[,ticks]) -> Stoppable
| ``stop`(self)` In multithreaded mode, stops threads started by self.threadloop()
| ``threadloop`(self)` Run self.runloop in a separate thread.
| ``timeout`(self)` Delayed.timeout() -> integer (representing seconds)

Class Variable Summary
`float` | `fudgefactor`
`class` | `IDelayed`

Method Details

### __init__(self)
(Constructor)

Initialize the delayed event queue.

### __setstate__(self, dict)

Delayed.__setstate__(dict) -> None

Flags this Delayed as current, so that unpickled Delayeds won't attempt to run hundreds of updates so they'll be current.

### later(self, func, ticks=0, args=())

Delayed.later(func [, ticks [, args]]) -> Stoppable

This function schedules the function 'func' for execution with the arguments 'args', 'ticks' ticks in the future. A 'tick' is one call to the 'run' function.

### loop(self, func, ticks=0, args=())

Delayed.loop(func[, ticks=0][, args=()]) -> Stoppable

This schedules the function *func* for repeating execution every *ticks* ticks.

### run(self)

Delayed.run() -> None

This runs one cycle of events, and moves the tickcount by one. (I would say "increments", but it actually decrements it for simplicity of implementation reasons. -glyph)

### runEverything(self)

Run all currently-pending callbacks.

### runloop(self)

Runs until the is_running flag is false.

### runUntilCurrent(self)

Delayed.runUntilCurrent() -> None

This will run this delayed object until it is up-to-date with delay expects to get another run() callthe current clock time.

### step(self, func, list, ticks=0)

Delayed.step(func,list[,ticks]) -> Stoppable

This schedules the function *func* for execution with each element in *list* as its only argument, pausing *ticks* ticks between each invocation.

### stop(self)

In multithreaded mode, stops threads started by self.threadloop()

### threadloop(self)

Run self.runloop in a separate thread.

### timeout(self)

Delayed.timeout() -> integer (representing seconds)

This says approximately how long from the current time this delay expects to get another run() call.

Class Variable Details

### fudgefactor

  Type:
    `float`
  Value:

        0.01

### IDelayed

`IDelayed` = `twisted.python.delay.IDelayed`

Generated by Epydoc 1.1 on Sat Feb 15 21:18:04 2003 | http://epydoc.sf.net