B
     \y                 @   s2   d dl Z d dlZG dd deZe Zdd ZdS )    Nc               @   sL   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dS )_CompilerLockc             C   s   t  | _d S )N)	threadingRLock_lock)self r   2lib/python3.7/site-packages/numba/compiler_lock.py__init__   s    z_CompilerLock.__init__c             C   s   | j   d S )N)r   acquire)r   r   r   r   r
   
   s    z_CompilerLock.acquirec             C   s   | j   d S )N)r   release)r   r   r   r   r      s    z_CompilerLock.releasec             C   s   |    d S )N)r
   )r   r   r   r   	__enter__   s    z_CompilerLock.__enter__c             C   s   |    d S )N)r   )r   Zexc_valexc_type	tracebackr   r   r   __exit__   s    z_CompilerLock.__exit__c             C   s    t | jd}t|s| j}| S )N	_is_owned)getattrr   callabler   )r   Zis_ownedr   r   r   	is_locked   s    z_CompilerLock.is_lockedc                s   t   fdd}|S )Nc           	      s     | |S Q R X d S )Nr   )argskwargs)funcr   r   r   _acquire_compile_lock   s    z5_CompilerLock.__call__.<locals>._acquire_compile_lock)	functoolswraps)r   r   r   r   )r   r   r   __call__   s    z_CompilerLock.__call__c             C   s"   | j dr| j   dS dS d S )Nr   FT)r   r
   r   )r   r   r   r   r   #   s    
z_CompilerLock._is_ownedN)__name__
__module____qualname__r	   r
   r   r   r   r   r   r   r   r   r   r   r      s   r   c               C   s   t  stdS )z=Sentry that checks the global_compiler_lock is acquired.
    N)global_compiler_lockr   AssertionErrorr   r   r   r   require_global_compiler_lock1   s    r    )r   r   objectr   r   r    r   r   r   r   <module>   s   (