
    q                     v    S r / SQrSr " S S\5      r0 4S jrS rS rS rSS
 jr	 " S S\
5      rSqSqS rg	)a  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:
        try:
            import _thread  # Python >= 3
        except:
            import thread as _thread  # Python < 3
    except ImportError:
        import _dummy_thread as _thread

)errorstart_new_threadexit	get_identallocate_lockinterrupt_mainLockTypel        c                       \ rS rSrSrS rSrg)r      z&Dummy implementation of _thread.error.c                     Xl         g Nargs)selfr   s     .lib/third_party/functools32/_dummy_thread32.py__init__error.__init__!   s    	    r   N)__name__
__module____qualname____firstlineno____doc__r   __static_attributes__ r   r   r   r      s
    0r   r   c                 <   [        U5      [        [        5       5      :w  a  [        S5      e[        U5      [        [        5       5      :w  a  [        S5      eSq U " U0 UD6  Sq[        (       a  Sq[        eg! [
         a     N"  SSKnUR                  5          N9= f)a  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.

z2nd arg must be a tuplez3rd arg must be a dictF    NT)
typetuple	TypeErrordict_main
SystemExit	traceback	print_exc
_interruptKeyboardInterrupt)functionr   kwargsr#   s       r   r   r   $   s     DzT%']"122F|tDF|#011E$!&! Ez
   s   A8 8
BBc                      [         e)z'Dummy implementation of _thread.exit().)r"   r   r   r   r   r   D   s    
r   c                      g)zDummy 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.
r   r   r   r   r   r   H   s     r   c                      [        5       $ )z0Dummy implementation of _thread.allocate_lock().)r   r   r   r   r   r   Q   s
    :r   Nc                      U b  [        S5      eg)z-Dummy implementation of _thread.stack_size().z'setting thread stack size not supportedr   )r   )sizes    r   
stack_sizer/   U   s    =>>r   c                   >    \ rS rSrSrS rS
S jr\rS rS r	S r
S	rg)r   [   au  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                     SU l         g )NFlocked_statusr   s    r   r   LockType.__init__f   s
    "r   Nc                     Ub  U(       a  SU l         gU R                   (       d  SU l         gUS:  a  SSKnUR                  U5        g)aq  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.

NTr   F)r4   timesleep)r   waitflagtimeoutr8   s       r   acquireLockType.acquirei   sD     x!%D%%%)"Q;JJw'r   c                 $    U R                  5         g r   )release)r   typvaltbs       r   __exit__LockType.__exit__   s    r   c                 @    U R                   (       d  [        eSU l         g)zRelease the dummy lock.FT)r4   r   r5   s    r   r?   LockType.release   s     !!K"r   c                     U R                   $ r   r3   r5   s    r   lockedLockType.locked   s    !!!r   r3   )Nr+   )r   r   r   r   r   r   r<   	__enter__rC   r?   rH   r   r   r   r   r   r   [   s'    #0 I"r   r   FTc                  *    [         (       a  [        eSqg)zZSet _interrupt flag to True to have start_new_thread raise
KeyboardInterrupt upon exiting.TN)r!   r&   r%   r   r   r   r   r      s     u 
r   r   )r   __all__TIMEOUT_MAX	Exceptionr   r   r   r   r   r/   objectr   r%   r!   r   r   r   r   <module>rP      sa   $) I  -/  @5"v 5"p 
r   