Your IP : 3.21.46.13
B
� f�� � @ s� d Z ddlZddlZddlZddlmZ ddl m
Z ddlm
Z
ddlmZmZ yddlmZ W n ek
r� ddlmZ Y nX dd d
ddd
dddddddddddddddgZejZejZejZejZejZ y
ej!Z"W n e#k
r� dZ"Y nX ej$Z$[da%da&dd� Z'dd� Z(eZ)dd� Z!G d d!� d!�Z*e*Z+G d"d
� d
�Z,G d#d� d�Z-G d$d� de-�Z.G d%d� d�Z/G d&d� d�Z0G d'd� de1�Z2e� j3Z4e4� d@d)d*�Z5e� a6i Z7i Z8e
� Z9e� a:e;� a<G d+d� d�Z=G d,d� de=�Z>G d-d.� d.e=�Z?G d/d0� d0e=�Z@d1d� ZAeAZBd2d � ZCeCZDd3d4� ZEd5d� ZFdd6lmGZG e?� aHd7d8� ZId9d
� ZJydd:lmKZL W n" ek
�rz dd;lMmLZL Y nX d<d=� ZNeOed>��r�ejPeNd?� dS )Az;Thread module emulating a subset of Java's threading model.� N)� monotonic)�
format_exc)�WeakSet)�islice�count)�deque� get_ident�active_count� Condition�current_thread� enumerate�main_thread�TIMEOUT_MAX�Event�Lock�RLock� Semaphore�BoundedSemaphore�Thread�Barrier�BrokenBarrierError�Timer�ThreadError�
setprofile�settrace�local�
stack_sizec C s | a dS )z�Set a profile function for all threads started from the threading module.
The func will be passed to sys.setprofile() for each thread, before its
run() method is called.
N)�
_profile_hook)�func� r �./opt/alt/python37/lib64/python3.7/threading.pyr 3 s c C s | a dS )z�Set a trace function for all threads started from the threading module.
The func will be passed to sys.settrace() for each thread, before its run()
method is called.
N)�_trace_hook)r r r r r = s c O s t dkrt| |�S t | |�S )a2 Factory function that returns a new reentrant lock.
A reentrant lock must be released by the thread that acquired it. Once a
thread has acquired a reentrant lock, the same thread may acquire it again
without blocking; the thread must release it once for each time it has
acquired it.
N)�_CRLock�_PyRLock)�args�kwargsr r r r K s
c @ sV e Zd ZdZdd� Zdd� Zddd �ZeZd
d� Zdd
� Z dd� Z
dd� Zdd� ZdS )�_RLocka, This class implements reentrant lock objects.
A reentrant lock must be released by the thread that acquired it. Once a
thread has acquired a reentrant lock, the same thread may acquire it
again without blocking; the thread must release it once for each time it
has acquired it.
c C s t � | _d | _d| _d S )Nr )�_allocate_lock�_block�_owner�_count)�selfr r r �__init__b s z_RLock.__init__c C s^ | j }yt| j}W n tk
r( Y nX d| j�� r:dnd| jj| jj|| j t
t| ��f S )Nz)<%s %s.%s object owner=%r count=%d at %s>�lockedZunlocked)r) �_active�name�KeyErrorr( r- � __class__�
__module__�__qualname__r* �hex�id)r+ �ownerr r r �__repr__g s z_RLock.__repr__T���c C sD t � }| j|kr"| jd7 _dS | j�||�}|r@|| _d| _|S )a Acquire a lock, blocking or non-blocking.
When invoked without arguments: if this thread already owns the lock,
increment the recursion level by one, and return immediately. Otherwise,
if another thread owns the lock, block until the lock is unlocked. Once
the lock is unlocked (not owned by any thread), then grab ownership, set
the recursion level to one, and return. If more than one thread is
blocked waiting until the lock is unlocked, only one at a time will be
able to grab ownership of the lock. There is no return value in this
case.
When invoked with the blocking argument set to true, do the same thing
as when called without arguments, and return true.
When invoked with the blocking argument set to false, do not block. If a
call without an argument would block, return false immediately;
otherwise, do the same thing as when called without arguments, and
return true.
When invoked with the floating-point timeout argument set to a positive
value, block for at most the number of seconds specified by timeout
and as long as the lock cannot be acquired. Return true if the lock has
been acquired, false if the timeout has elapsed.
� )r r) r* r( �acquire)r+ �blocking�timeout�me�rcr r r r: v s
z_RLock.acquirec C s<