Your IP : 3.141.198.75


Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/_dummy_thread.cpython-38.pyc

U

i�f��@s�dZddddddddgZd	ZeZifd
d�Zdd�Zdd�Zd
d�Zddd�Z	dd�Z
Gdd�de�ZGdd�de�Z
dadadd�ZdS)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:
        import _thread
    except ImportError:
        import _dummy_thread as _thread

�error�start_new_thread�exit�	get_ident�
allocate_lock�interrupt_main�LockType�RLocklcCs�t|�tt��krtd��t|�tt��kr4td��daz|||�Wn.tk
rZYnddl}|��YnXdatr�dat	�dS)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.

    z2nd arg must be a tuplez3rd arg must be a dictF�NT)
�type�tuple�	TypeError�dict�_main�
SystemExit�	traceback�	print_exc�
_interrupt�KeyboardInterrupt)Zfunction�args�kwargsr�r�2/opt/alt/python38/lib64/python3.8/_dummy_thread.pyrs 
cCst�dS)z'Dummy implementation of _thread.exit().N)rrrrrr=scCsdS)z�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.
    �rrrrrrAscCst�S)z0Dummy implementation of _thread.allocate_lock().�rrrrrrJsNcCs|dk	rtd��dS)z-Dummy implementation of _thread.stack_size().Nz'setting thread stack size not supportedr	)r)�sizerrr�
stack_sizeNsrcCst�S)z0Dummy implementation of _thread._set_sentinel().rrrrr�
_set_sentinelTsrc@sFeZdZdZdd�Zddd�ZeZdd	�Zd
d�Zdd
�Z	dd�Z
dS)ra�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.

    cCs
d|_dS)NF��
locked_status��selfrrr�__init__cszLockType.__init__N���cCsH|dks|rd|_dS|js&d|_dS|dkr@ddl}|�|�dSdS)a�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)r�time�sleep)r �waitflag�timeoutr#rrr�acquirefs
zLockType.acquirecCs|��dS�N)�release)r �typ�val�tbrrr�__exit__�szLockType.__exit__cCs|js
t�d|_dS)zRelease the dummy lock.FT)rrrrrrr)�szLockType.releasecCs|jSr(rrrrr�locked�szLockType.lockedcCs*d|jrdnd|jj|jjtt|��fS)Nz<%s %s.%s object at %s>r.Zunlocked)r�	__class__�
__module__�__qualname__�hex�idrrrr�__repr__�s
�zLockType.__repr__)Nr")�__name__r0r1�__doc__r!r'�	__enter__r-r)r.r4rrrrrXs

	cs:eZdZdZ�fdd�Zd
�fdd�	Z�fdd	�Z�ZS)raDummy implementation of threading._RLock.

    Re-entrant lock can be aquired multiple times and needs to be released
    just as many times. This dummy implemention does not check wheter the
    current thread actually owns the lock, but does accounting on the call
    counts.
    cst���d|_dS)Nr	)�superr!�_levelsr�r/rrr!�s
zRLock.__init__Nr"cs$t��||�}|r |jd7_|S)zEAquire the lock, can be called multiple times in succession.
        r)r8r'r9)r r%r&r.r:rrr'�sz
RLock.acquirecs4|jdkrt�|jdkr"t���|jd8_dS)zERelease needs to be called once for every call to acquire().
        r	rN)r9rr8r)rr:rrr)�s



z
RLock.release)Nr")r5r0r1r6r!r'r)�
__classcell__rrr:rr�sFTcCstr
t�ndadS)z^Set _interrupt flag to True to have start_new_thread raise
    KeyboardInterrupt upon exiting.TN)rrrrrrrr�s)N)r6�__all__�TIMEOUT_MAX�RuntimeErrorrrrrrrr�objectrrrrrrrrr�<module>s$
� 	
@

?>