Table of Contents

Module: main Twisted-0.17.4/twisted/internet/main.py
Imported modules   
import app
import os
import process
import socket
import sys
import time
from twisted.persisted import styles
from twisted.python import threadable, log, delay
from twisted.python.defer import Deferred, DeferredList
from twisted.python.runtime import platform
import types
Functions   
_preenDescriptors
addDelayed
addReader
addTimeout
addWriter
callAfterShutdown
callBeforeShutdown
callDuringShutdown
callWhenRunning
disconnectAll
doSelect
handleSignals
initThreads
installWaker
iterate
removeAll
removeCallAfterShutdown
removeCallBeforeShutdown
removeCallDuringShutdown
removeDelayed
removeReader
removeWriter
run
runUntilCurrent
shutDown
stopMainLoop
wakeUp
  _preenDescriptors 
_preenDescriptors ()

  addDelayed 
addDelayed ( delayed )

Add an object implementing the IDelayed interface to the event loop.

See twisted.python.delay.IDelayed for more details.

  addReader 
addReader ( reader )

Add a FileDescriptor for notification of data available to read.

  addTimeout 
addTimeout ( method,  seconds )

Add a method which will time out after a given interval.

The given method will always time out before a server shuts down, and will never persist.

  addWriter 
addWriter ( writer )

Add a FileDescriptor for notification of data available to write.

  callAfterShutdown 
callAfterShutdown ( function )

  callBeforeShutdown 
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 
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 
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.

  disconnectAll 
disconnectAll ()

Disconnect every reader, and writer in the system.

  doSelect 
doSelect (
        timeout,
        reads=reads,
        writes=writes,
        rhk=reads.has_key,
        whk=writes.has_key,
        )

Run one iteration of the I/O monitor loop.

This will run all selectables who had input or output readiness waiting for them.

  handleSignals 
handleSignals ()

Install the signal handlers for the Twisted event loop.

  initThreads 
initThreads ()

Perform initialization required for threading.

  installWaker 
installWaker ()

Install a `waker' to allow other threads to wake up the IO thread.

  iterate 
iterate ( timeout=0. )

Do one iteration of the main loop.

I will run any simulated (delayed) code, and process any pending I/O. I will not block. This is meant to be called from a high-freqency updating loop function like the frame-processing function of a game.

  removeAll 
removeAll ()

Remove all readers and writers, and return list of Selectables.

  removeCallAfterShutdown 
removeCallAfterShutdown ( function )

  removeCallBeforeShutdown 
removeCallBeforeShutdown ( function )

Remove a function registered with callBeforeShutdown.

  removeCallDuringShutdown 
removeCallDuringShutdown ( function )

  removeDelayed 
removeDelayed ( delayed )

Remove a Delayed object from the event loop.

  removeReader 
removeReader ( reader )

Remove a Selectable for notification of data available to read.

  removeWriter 
removeWriter ( writer )

Remove a Selectable for notification of data available to write.

  run 
run ( installSignalHandlers=1 )

Run input/output and dispatched/delayed code.

This call "never" returns. It is the main loop which runs delayed timers (see twisted.python.delay and addDelayed), and the I/O monitor (doSelect).

  runUntilCurrent 
runUntilCurrent ()

Run all delayed loops and return a timeout for when the next call expects to be made.

  shutDown 
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.

Exceptions   
RuntimeError( "Shut down exception!" )
  stopMainLoop 
stopMainLoop ( *ignored )

  wakeUp 
wakeUp ()

Classes   
DummyResolver

An implementation of a synchronous resolver, from Python's socket stuff.

_UnixWaker

This class provides a simple interface to wake up the select() loop.

_Win32Waker

I am a workaround for the lack of pipes on win32.


Table of Contents

This document was automatically generated on Sat Apr 20 01:30:49 2002 by HappyDoc version 2.0