;ò
íŒü?c           @   s¢   d  Z  d Z d Z d d d d d d d	 g Z d
 k Z d e f d „  ƒ  YZ h  d „ Z d „  Z	 d „  Z
 d „  Z d	 e f d „  ƒ  YZ e a e a d „  Z d
 S(   s,  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

s   Brett Cannons   brett@python.orgs   errors   start_new_threads   exits	   get_idents   allocate_locks   interrupt_mains   LockTypeNc           B   s   t  Z d  Z d „  Z RS(   s%   Dummy implementation of thread.error.c         G   s   | |  _  d  S(   N(   s   argss   self(   s   selfs   args(    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   __init__   s    (   s   __name__s
   __module__s   __doc__s   __init__(    (    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   error   s    c         C   s¶   t  | ƒ t  t ƒ  ƒ j o t d ƒ ‚ n t  | ƒ t  t ƒ  ƒ j o t d ƒ ‚ n t a y |  | | Ž  Wn# t	 j
 o n t
 i ƒ  n Xt a t o t a t ‚ n d S(   sä  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.

    s   2nd arg must be a tuples   3rd arg must be a dictN(   s   types   argss   tuples	   TypeErrors   kwargss   dicts   Falses   _mains   functions
   SystemExits
   _tracebacks	   print_excs   Trues
   _interrupts   KeyboardInterrupt(   s   functions   argss   kwargs(    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   start_new_thread   s$       c           C   s
   t  ‚ d S(   s&   Dummy implementation of thread.exit().N(   s
   SystemExit(    (    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   exit=   s     c           C   s   d Sd S(   sò   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.
    iÿÿÿÿN(    (    (    (    s)   /mit/python/lib/python2.3/dummy_thread.pys	   get_identA   s     c           C   s   t  ƒ  Sd S(   s/   Dummy implementation of thread.allocate_lock().N(   s   LockType(    (    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   allocate_lockJ   s     c           B   s5   t  Z d  Z d „  Z e d „ Z d „  Z d „  Z RS(   s‹  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.

    c         C   s   t  |  _ d  S(   N(   s   Falses   selfs   locked_status(   s   self(    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   __init__Y   s    c         C   s[   | t j o t |  _ t Sn: | o$ |  i o t |  _ t SqW t Sn t |  _ t Sd S(   s©  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.

        N(   s   waitflags   Nones   Trues   selfs   locked_statuss   False(   s   selfs   waitflag(    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   acquire\   s    
 			c         C   s&   |  i o
 t ‚ n t |  _ t Sd S(   s   Release the dummy lock.N(   s   selfs   locked_statuss   errors   Falses   True(   s   self(    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   releaset   s
     
	c         C   s   |  i Sd  S(   N(   s   selfs   locked_status(   s   self(    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   locked}   s    (   s   __name__s
   __module__s   __doc__s   __init__s   Nones   acquires   releases   locked(    (    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   LockTypeN   s
   	 			c           C   s   t  o
 t ‚ n t a d S(   s^   Set _interrupt flag to True to have start_new_thread raise
    KeyboardInterrupt upon exiting.N(   s   _mains   KeyboardInterrupts   Trues
   _interrupt(    (    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   interrupt_main…   s
     
 (   s   __doc__s
   __author__s	   __email__s   __all__s	   tracebacks
   _tracebacks	   Exceptions   errors   start_new_threads   exits	   get_idents   allocate_locks   objects   LockTypes   Falses
   _interrupts   Trues   _mains   interrupt_main(   s	   get_idents   __all__s   allocate_locks
   _tracebacks   start_new_threads
   __author__s	   __email__s   exits   interrupt_mains   errors   LockType(    (    s)   /mit/python/lib/python2.3/dummy_thread.pys   ?   s   					3