twisted.internet.main

Package twisted :: Package internet :: Module main |
[frames | no frames]

## Module twisted.internet.main

Backwards compatability, and utility functions.

In general, this module should not be used, other than by reactor authors who need to use the 'installReactor' method.

Maintainer: Itamar Shtull-Trauring

Function Summary
| `_getReactor()`
| `addTimeout(m, t, f)`
| `callAfterShutdown(function)`
| ``callBeforeShutdown`(function)` Add a function to be called before shutdown begins.
| ``callDuringShutdown`(function)` Add a function to be called during shutdown.
| ``callWhenRunning`(function)` Add a function to be called when the system starts running.
| `installReactor(reactor)`
| `removeCallAfterShutdown(function)`
| ``removeCallBeforeShutdown`(function)` Remove a function registered with callBeforeShutdown.
| `removeCallDuringShutdown(function)`
| ``run`(installSignalHandlers)` Run input/output and dispatched/delayed code.
| ``shutDown`(*ignored)` Run all shutdown callbacks (save all running Applications) and exit.
| `stopMainLoop(*ignored)`

Variable Summary
`list` | `afterShutdown` = `[]`
`list` | `beforeShutdown` = `[]`
`ConnectionDone` | `CONNECTION_DONE` = `<twisted.internet.error.ConnectionDone...`
`ConnectionLost` | `CONNECTION_LOST` = `<twisted.internet.error.ConnectionLost...`
`list` | `duringShutdown` = `[]`
`int` | `interruptCountdown` = 5
`NoneType` | `running` = None
`NoneType` | `shuttingDown` = None

Function Details

### callBeforeShutdown(function) Add a function to be called before shutdown begins. These functions are tasks to be performed in order to run a "clean" shutdown. This may involve tasks that keep the mainloop running, so any function registered in this list may return a Deferred, which will delay the actual shutdown until later.

### callDuringShutdown(function) Add a function to be called during shutdown. These functions ought to shut down the event loop -- stopping thread pools, closing down all connections, etc.

### callWhenRunning(function) Add a function to be called when the system starts running. If the system is already running, then the function runs immediately. If the system has not yet started running, the function will be queued to get run when the mainloop starts.

### removeCallBeforeShutdown(function) Remove a function registered with callBeforeShutdown.

### run(installSignalHandlers=1) Run input/output and dispatched/delayed code. Don't call this directly. This call "never" returns.

### shutDown(*ignored) Run all shutdown callbacks (save all running Applications) and exit. This is called by various signal handlers which should cause the process to exit. It can also be called directly in order to trigger a clean shutdown.

Variable Details

    ### afterShutdown Type: `list` Value:
        []

    ### beforeShutdown Type: `list` Value:
        []

    ### CONNECTION_DONE Type: `ConnectionDone` Value:
        <twisted.internet.error.ConnectionDone instance at 0x8269884>

    ### CONNECTION_LOST Type: `ConnectionLost` Value:
        <twisted.internet.error.ConnectionLost instance at 0x826be2c>

    ### duringShutdown Type: `list` Value:
        []

    ### interruptCountdown Type: `int` Value:
        5

    ### running Type: `NoneType` Value:
        None

    ### shuttingDown Type: `NoneType` Value:
        None

Generated by Epydoc 2.0 on Sat May 15 20:08:08 2004 | http://epydoc.sf.net