/snap/core20/2866/usr/lib/python3.8/concurrent/futures/__pycache__
Edit: /snap/core20/2866/usr/lib/python3.8/concurrent/futures/__pycache__/thread.cpython-38.pyc (5818B)
U
ʦi@" @ s d Z dZddlZddlmZ ddlZddlZddlZddlZddl Z e
Zdadd Z
ee
G dd d eZd
d ZG dd
d
ejZG dd dejZdS )zImplements ThreadPoolExecutor.z"Brian Quinlan (brian@sweetapp.com) N)_baseFc C sB da tt } | D ]\}}|d q| D ]\}}| q,d S NT) _shutdownlist_threads_queuesitemsputjoin)r tq r //usr/lib/python3.8/concurrent/futures/thread.py_python_exit! s r c @ s e Zd Zdd Zdd ZdS ) _WorkItemc C s || _ || _|| _|| _d S N)futurefnargskwargs)selfr r r r r r r
__init__. s z_WorkItem.__init__c
C sf | j sd S z| j| j| j}W n2 tk
rT } z| j | d } W 5 d }~X Y nX | j | d S r )r Zset_running_or_notify_cancelr r r
BaseException
set_exceptionZ
set_result)r resultexcr r r
run4 s
z
_WorkItem.runN)__name__
__module____qualname__r r r r r r
r - s r c C s |d k rRz|| W n< t k
rP tjjddd | }|d k rJ| Y d S X zx|jdd}|d k r| ~| }|d k r|j ~qT| }t s|d ks|j r|d k rd|_ |
d W d S ~qTW n$ t k
r tjjddd Y nX d S )NzException in initializer:T)exc_info)blockzException in worker)r r ZLOGGERZcritical_initializer_failedgetr _idle_semaphorereleaser r )Zexecutor_referenceZ
work_queueinitializerinitargsZexecutor work_itemr r r
_workerB s8
r( c @ s e Zd ZdZdS )BrokenThreadPoolzR
Raised when a worker thread in a ThreadPoolExecutor failed initializing.
N)r r r __doc__r r r r
r) m s r) c @ sf e Zd Ze jZdddZdd Ze j
jje_e j
jje_dd Z
d
d Zdd
dZe j
jje_dS )ThreadPoolExecutorN r c C s |dkrt dt pdd }|dkr.td|dk rFt|sFtd|| _t | _ t
d| _t
| _d| _d| _t
| _|pd | | _|| _|| _dS )
a Initializes a new ThreadPoolExecutor instance.
Args:
max_workers: The maximum number of threads that can be used to
execute the given calls.
thread_name_prefix: An optional name prefix to give our threads.
initializer: A callable used to initialize worker threads.
initargs: A tuple of arguments to pass to the initializer.
N r z"max_workers must be greater than 0zinitializer must be a callableFzThreadPoolExecutor-%d)minos cpu_count
ValueErrorcallable TypeError_max_workersqueueZSimpleQueue_work_queue threadingZ Semaphorer# set_threads_brokenr ZLock_shutdown_lock_counter_thread_name_prefix_initializer _initargs)r Zmax_workersZthread_name_prefixr% r&