dummy_thread
index
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/dummy_thread.py
Module Docs

Drop-in replacement for the thread module.
 
Meant to be used as a brain-dead substitute so that threaded code does
not need to be rewritten for when the thread module is not present.
 
Suggested usage is::
 
    try:
        import thread
    except ImportError:
        import dummy_thread as thread

 
Modules
       
traceback

 
Classes
       
__builtin__.object
LockType
exceptions.Exception(exceptions.BaseException)
error

 
class LockType(__builtin__.object)
    Class implementing dummy implementation of thread.LockType.
 
Compatibility is maintained by maintaining self.locked_status
which is a boolean that stores the state of the lock.  Pickling of
the lock, though, should not be done since if the thread module is
then used with an unpickled ``lock()`` from here problems could
occur from this class not having atomic methods.
 
  Methods defined here:
__enter__ = acquire(self, waitflag=None)
__exit__(self, typ, val, tb)
__init__(self)
acquire(self, waitflag=None)
Dummy implementation of acquire().
 
For blocking calls, self.locked_status is automatically set to
True and returned appropriately based on value of
``waitflag``.  If it is non-blocking, then the value is
actually checked and not set if it is already acquired.  This
is all done so that threading.Condition's assert statements
aren't triggered and throw a little fit.
locked(self)
release(self)
Release the dummy lock.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class error(exceptions.Exception)
    Dummy implementation of thread.error.
 
 
Method resolution order:
error
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, *args)

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
Functions
       
allocate_lock()
Dummy implementation of thread.allocate_lock().
exit()
Dummy implementation of thread.exit().
get_ident()
Dummy implementation of thread.get_ident().
 
Since this module should only be used when threadmodule is not
available, it is safe to assume that the current process is the
only thread.  Thus a constant can be safely returned.
interrupt_main()
Set _interrupt flag to True to have start_new_thread raise
KeyboardInterrupt upon exiting.
start_new_thread(function, args, kwargs={})
Dummy implementation of thread.start_new_thread().
 
Compatibility is maintained by making sure that ``args`` is a
tuple and ``kwargs`` is a dictionary.  If an exception is raised
and it is SystemExit (which can be done by thread.exit()) it is
caught and nothing is done; all other exceptions are printed out
by using traceback.print_exc().
 
If the executed function calls interrupt_main the KeyboardInterrupt will be
raised when the function returns.

 
Data
        __all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock', 'interrupt_main', 'LockType']