ok

Mini Shell

Direktori : /opt/alt/python35/lib64/python3.5/concurrent/futures/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/concurrent/futures/__pycache__/thread.cpython-35.opt-1.pyc



J�Ma�@s�dZdZddlZddlmZddlZddlZddlZddlZej	�Z
dadd�Zej
e�Gdd	�d	e�Zd
d�ZGdd
�d
ej�ZdS)zImplements ThreadPoolExecutor.z"Brian Quinlan (brian@sweetapp.com)�N)�_baseFcCsadattj��}x!|D]\}}|jd�qWx|D]\}}|j�qCWdS)NT)�	_shutdown�list�_threads_queues�items�put�join)r�t�q�r�>/opt/alt/python35/lib64/python3.5/concurrent/futures/thread.py�_python_exit sr
c@s(eZdZdd�Zdd�ZdS)�	_WorkItemcCs(||_||_||_||_dS)N)�future�fn�args�kwargs)�selfrrrrrrr�__init__,s			z_WorkItem.__init__cCs{|jj�sdSy|j|j|j�}Wn5tk
rf}z|jj|�WYdd}~XnX|jj|�dS)N)rZset_running_or_notify_cancelrrr�
BaseExceptionZ
set_exceptionZ
set_result)r�result�errr�run2s#z
_WorkItem.runN)�__name__�
__module__�__qualname__rrrrrrr+srcCs�yqxj|jdd�}|dk	r4|j�~q|�}tsX|dksX|jri|jd�dS~qWWn(tk
r�tjjddd�YnXdS)N�blockTzException in worker�exc_info)�getrrrrrZLOGGERZcritical)Zexecutor_referenceZ
work_queueZ	work_itemZexecutorrrr�_worker=s
	

rc@sjeZdZddd�Zdd�Zejjje_dd�Zdd	d
�Z	ejj	je	_dS)�ThreadPoolExecutorNcCsz|dkr"tj�pdd}|dkr:td��||_tj�|_t�|_d|_	t
j�|_dS)z�Initializes a new ThreadPoolExecutor instance.

        Args:
            max_workers: The maximum number of threads that can be used to
                execute the given calls.
        N��rz"max_workers must be greater than 0F)
�os�	cpu_count�
ValueError�_max_workers�queueZQueue�_work_queue�set�_threadsr�	threadingZLock�_shutdown_lock)rZmax_workersrrrrTs		zThreadPoolExecutor.__init__cOsi|j�Y|jrtd��tj�}t||||�}|jj|�|j�|SWdQRXdS)Nz*cannot schedule new futures after shutdown)	r,r�RuntimeErrorrZFuturerr(r�_adjust_thread_count)rrrr�f�wrrr�submiths
	
zThreadPoolExecutor.submitcCs�|jdd�}t|j�|jkr�tjdtdtj||�|jf�}d|_	|j
�|jj|�|jt|<dS)NcSs|jd�dS)N)r)�_r
rrr�
weakref_cbxsz;ThreadPoolExecutor._adjust_thread_count.<locals>.weakref_cb�targetrT)
r(�lenr*r&r+ZThreadr�weakref�refZdaemon�start�addr)rr3r	rrrr.us	
z'ThreadPoolExecutor._adjust_thread_countTc	CsR|j�d|_|jjd�WdQRX|rNx|jD]}|j�q:WdS)NT)r,rr(rr*r)r�waitr	rrr�shutdown�s
	zThreadPoolExecutor.shutdown)
rrrrr1r�Executor�__doc__r.r;rrrrr Ssr )r=�
__author__�atexitZconcurrent.futuresrr'r+r6r#�WeakKeyDictionaryrrr
�register�objectrrr<r rrrr�<module>s	


Zerion Mini Shell 1.0