;
Êâ"Ic               @   sŸ   d  Z  d d d d d d d g Z d d	 l Z Gd
 „  d e ƒ Z i  d „ Z d „  Z d „  Z d „  Z	 d	 d „ Z Gd „  d e ƒ Z d a d a d „  Z d	 S(   u/  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

u   erroru   start_new_threadu   exitu	   get_identu   allocate_locku   interrupt_mainu   LockTypei    Nc             B   s   |  Ee  Z d  Z d „  Z d S(   u&   Dummy implementation of _thread.error.c             G   s   | |  _  d  S(   N(   u   args(   u   selfu   args(    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   __init__   s    N(   u   __name__u
   __module__u   __doc__u   __init__(   u
   __locals__(    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   error   s   
c          	   C   s¸   t  | ƒ t  t ƒ  ƒ k o t d ƒ ‚ n t  | ƒ t  t ƒ  ƒ k o t d ƒ ‚ n d a y |  | | Ž  Wn% t k
 o Yn t j ƒ  Yn Xd a t
 o d a
 t ‚ n d S(   uæ  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.

    u   2nd arg must be a tupleu   3rd arg must be a dictNFT(   u   typeu   tupleu	   TypeErroru   dictu   Falseu   _mainu
   SystemExitu
   _tracebacku	   print_excu   Trueu
   _interruptu   KeyboardInterrupt(   u   functionu   argsu   kwargs(    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   start_new_thread   s    c               C   s
   t  ‚ d S(   u'   Dummy implementation of _thread.exit().N(   u
   SystemExit(    (    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   exit:   s    c               C   s   d S(   uô   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ÿÿÿÿ(    (    (    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu	   get_ident>   s    c               C   s   t  ƒ  S(   u0   Dummy implementation of _thread.allocate_lock().(   u   LockType(    (    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   allocate_lockG   s    c             C   s!   |  d k	 o t d ƒ ‚ n d S(   u-   Dummy implementation of _thread.stack_size().u'   setting thread stack size not supportedi    N(   u   Noneu   error(   u   size(    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu
   stack_sizeK   s    c             B   sJ   |  Ee  Z d  Z d „  Z d d „ Z e Z d „  Z d „  Z d „  Z	 d S(   u  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   d |  _ d  S(   NF(   u   Falseu   locked_status(   u   self(    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   __init__\   s    c             C   sB   | d k p | o d |  _ d S|  j p d |  _ d Sd Sd S(   u©  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.

        NTF(   u   Noneu   Trueu   locked_statusu   False(   u   selfu   waitflag(    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   acquire_   s    	
	c             C   s   |  j  ƒ  d  S(   N(   u   release(   u   selfu   typu   valu   tb(    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   __exit__v   s    c             C   s!   |  j  p
 t ‚ n d |  _  d S(   u   Release the dummy lock.FT(   u   locked_statusu   erroru   Falseu   True(   u   self(    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   releasey   s    

	c             C   s   |  j  S(   N(   u   locked_status(   u   self(    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   locked‚   s    N(
   u   __name__u
   __module__u   __doc__u   __init__u   Noneu   acquireu	   __enter__u   __exit__u   releaseu   locked(   u
   __locals__(    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   LockTypeQ   s   
					c               C   s   t  o
 t ‚ n d a d S(   u^   Set _interrupt flag to True to have start_new_thread raise
    KeyboardInterrupt upon exiting.NT(   u   _mainu   KeyboardInterruptu   Trueu
   _interrupt(    (    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   interrupt_mainŠ   s    
FT(   u   __doc__u   __all__u	   tracebacku
   _tracebacku	   Exceptionu   erroru   start_new_threadu   exitu	   get_identu   allocate_locku   Noneu
   stack_sizeu   objectu   LockTypeu   Falseu
   _interruptu   Trueu   _mainu   interrupt_main(    (    (    u*   /mit/python/lib/python3.0/_dummy_thread.pyu   <module>   s   				5