B
    u9a                 @   s   d dddddddgZ dZeZi fd	dZd
d Zdd Zdd ZdddZdd Z	G dd de
ZG dd deZdadadd ZdS )errorstart_new_threadexit	get_identallocate_lockinterrupt_mainLockTypeRLockl        c             C   s   t |t t krtdt |t t kr4tdday| || W n. tk
rZ   Y n   dd l}|  Y nX datrdat	d S )Nz2nd arg must be a tuplez3rd arg must be a dictF    T)
typetuple	TypeErrordict_main
SystemExit	traceback	print_exc
_interruptKeyboardInterrupt)Zfunctionargskwargsr    r   #/usr/lib/python3.7/_dummy_thread.pyr      s     c               C   s   t d S )N)r   r   r   r   r   r   =   s    c               C   s   dS )N   r   r   r   r   r   r   A   s    c               C   s   t  S )N)r   r   r   r   r   r   J   s    Nc             C   s   | d k	rt ddS )Nz'setting thread stack size not supportedr	   )r   )sizer   r   r   
stack_sizeN   s    r   c               C   s   t  S )N)r   r   r   r   r   _set_sentinelT   s    r   c               @   sB   e Zd Zdd ZdddZeZdd Zd	d
 Zdd Zdd Z	dS )r   c             C   s
   d| _ d S )NF)locked_status)selfr   r   r   __init__c   s    zLockType.__init__Nc             C   sH   |d ks|rd| _ dS | j s&d| _ dS |dkr@dd l}|| dS d S )NTr	   F)r   timeZsleep)r   waitflagtimeoutr    r   r   r   acquiref   s    
zLockType.acquirec             C   s   |    d S )N)release)r   typvaltbr   r   r   __exit__   s    zLockType.__exit__c             C   s   | j s
td| _ dS )NFT)r   r   )r   r   r   r   r$      s    zLockType.releasec             C   s   | j S )N)r   )r   r   r   r   locked   s    zLockType.lockedc             C   s*   d| j rdnd| jj| jjtt| f S )Nz<%s %s.%s object at %s>r)   Zunlocked)r   	__class__
__module____qualname__hexid)r   r   r   r   __repr__   s
    zLockType.__repr__)Nr   )
__name__r+   r,   r   r#   	__enter__r(   r$   r)   r/   r   r   r   r   r   X   s   
	c                   s6   e Zd Z fddZd	 fdd	Z fddZ  ZS )
r   c                s   t    d| _d S )Nr	   )superr   _levels)r   )r*   r   r   r      s    
zRLock.__init__Nr   c                s$   t  ||}|r |  jd7  _|S )Nr   )r2   r#   r3   )r   r!   r"   r)   )r*   r   r   r#      s    zRLock.acquirec                s4   | j dkrt| j dkr"t   |  j d8  _ d S )Nr	   r   )r3   r   r2   r$   )r   )r*   r   r   r$      s
    


zRLock.release)Nr   )r0   r+   r,   r   r#   r$   __classcell__r   r   )r*   r   r      s   FTc               C   s   t r
tndad S )NT)r   r   r   r   r   r   r   r      s    )N)__all__TIMEOUT_MAXRuntimeErrorr   r   r   r   r   r   r   objectr   r   r   r   r   r   r   r   r   <module>   s   

 	
@