Package twisted :: Package python :: Module threadable
[show private | hide private]
[frames | no frames]

Module twisted.python.threadable

A module that will allow your program to be multi-threaded, micro-threaded, and single-threaded. Currently microthreads are unimplemented. The idea is to abstract away some commonly used functionality so that I don't have to special-case it in all programs.
Classes
Waiter  
XLock Exclusive lock class.
_ThreadedWaiter  
_Waiter  
_XLock Exclusive lock class.

Exceptions
ThreadableError  

Function Summary
  init(with_threads)
Initialize threading.
  isInIOThread()
Are we in the thread responsable for I/O requests (the event loop)?
  registerAsIOThread()
Mark the current thread as responsable for I/O requests.
  synchronize(*klasses)
Make all methods listed in each class' synchronized attribute synchronized.
  whenThreaded(cb)
  _synchPost(self, *a, **b)
  _synchPre(self, *a, **b)

Variable Summary
None ioThread
list threadCallbacks
int threaded
list _to_be_synched

Function Details

init(with_threads=1)

Initialize threading. Should be run once, at the beginning of program.

isInIOThread()

Are we in the thread responsable for I/O requests (the event loop)?

registerAsIOThread()

Mark the current thread as responsable for I/O requests.

synchronize(*klasses)

Make all methods listed in each class' synchronized attribute synchronized.

The synchronized attribute should be a list of strings, consisting of the names of methods that must be synchronized. If we are running in threaded mode these methods will be wrapped with a lock.

Variable Details

ioThread

Type:
None
Value:
None                                                                   

threadCallbacks

Type:
list
Value:
[<function initThreads at 0x8122ae4>,
 <method ReactorBase.initThreads of SelectReactor instance at 0x834759\
c>]                                                                    

threaded

Type:
int
Value:
1                                                                      

_to_be_synched

Type:
list
Value:
[]                                                                     

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