Package twisted :: Package internet :: Module main

[show private | hide private]
[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<mailto:twisted@itamarst.org>

Classes
`Delayeds` | Wrapper for twisted.python.delay.IDelayed objects, so they use IReactorTime.
`DummyResolver` | An implementation of a synchronous resolver, from Python's socket stuff.

Function Summary
| `installReactor(reactor)`
| `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.
| `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)`
| `_getReactor()`

Variable Summary
`ConnectionLost` | `CONNECTION_LOST`
`ConnectionDone` | `CONNECTION_DONE`
`instance method` | `addDelayed`
`instance method` | `addReader`
`instance method` | `addWriter`
`list` | `afterShutdown`
`list` | `beforeShutdown`
`list` | `duringShutdown`
`int` | `interruptCountdown`
`instance method` | `iterate`
`Platform` | `platform`
`instance method` | `removeDelayed`
`instance method` | `removeReader`
`instance method` | `removeWriter`
`DummyResolver` | `resolver`
`None` | `running`
`None` | `shuttingDown`
`instance method` | `wakeUp`
`Delayeds` | `_delayeds`

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

### addDelayed

`addDelayed` = `twisted.internet.main.Delayeds.addDelayed`

### addReader

`addReader` = `twisted.internet.default.SelectReactor.addReader`

### addWriter

`addWriter` = `twisted.internet.default.SelectReactor.addWriter`

### afterShutdown

  Type:
    `list`
  Value:

        []

### beforeShutdown

  Type:
    `list`
  Value:

        []

### CONNECTION_DONE

  Type:
    `ConnectionDone`
  Value:

        <twisted.internet.error.ConnectionDone instance at 0x82b0e0c>

### CONNECTION_LOST

  Type:
    `ConnectionLost`
  Value:

        <twisted.internet.error.ConnectionLost instance at 0x833eb04>

### duringShutdown

  Type:
    `list`
  Value:

        []

### interruptCountdown

  Type:
    `int`
  Value:

        5

### iterate

`iterate` = `twisted.internet.base.ReactorBase.iterate`

### platform

  Type:
    `Platform`
  Value:

        <twisted.python.runtime.Platform instance at 0x8287864>

### removeDelayed

`removeDelayed` = `twisted.internet.main.Delayeds.removeDelayed`

### removeReader

`removeReader` = `twisted.internet.default.SelectReactor.removeReader`

### removeWriter

`removeWriter` = `twisted.internet.default.SelectReactor.removeWriter`

### resolver

  Type:
    `DummyResolver`
  Value:

        <twisted.internet.main.DummyResolver instance at 0x82b0d6c>

### running

  Type:
    `None`
  Value:

        None

### shuttingDown

  Type:
    `None`
  Value:

        None

### wakeUp

`wakeUp` = `twisted.internet.base.ReactorBase.wakeUp`

### _delayeds

  Type:
    `Delayeds`
  Value:

        <twisted.internet.main.Delayeds instance at 0x8266fac>

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