HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/concurrent/futures/__pycache__/thread.cpython-310.pyc
o

�N�gC"�@s�dZdZddlmZddlZddlZddlZddlZddlZddl	Z	e�
�Zdae�
�Zdd�Ze�e�ee	d�rEe	jejejejd	�Gd
d�de�Zdd
�ZGdd�dej�ZGdd�dej�ZdS)zImplements ThreadPoolExecutor.z"Brian Quinlan (brian@sweetapp.com)�)�_baseNFcCsft�
daWd�n1swYtt���}|D]	\}}|�d�q|D]\}}|��q(dS�NT)�_global_shutdown_lock�	_shutdown�list�_threads_queues�items�put�join)r�t�q�r
�?/opt/saltstack/salt/lib/python3.10/concurrent/futures/thread.py�_python_exits�
�r�register_at_fork)�before�after_in_child�after_in_parentc@s&eZdZdd�Zdd�Zeej�ZdS)�	_WorkItemcCs||_||_||_||_dS�N)�future�fn�args�kwargs)�selfrrrrr
r
r�__init__/s
z_WorkItem.__init__c
Csn|j��sdSz|j|ji|j��}Wnty.}z|j�|�d}WYd}~dSd}~ww|j�|�dSr)rZset_running_or_notify_cancelrrr�
BaseException�
set_exceptionZ
set_result)r�result�excr
r
r�run5s
��z
_WorkItem.runN)	�__name__�
__module__�__qualname__rr �classmethod�types�GenericAlias�__class_getitem__r
r
r
rr.s
rcCs�|dur(z||�Wnty'tjjddd�|�}|dur$|��YdSwz;	|jdd�}|durG|��~|�}|durE|j��~q)|�}t	sS|dusS|j	rb|durZd|_	|�
d�WdS~q*tyutjjddd�YdSw)NzException in initializer:T)�exc_info)�blockzException in worker)rrZLOGGER�critical�_initializer_failed�getr �_idle_semaphore�releaserr	)Zexecutor_referenceZ
work_queue�initializer�initargs�executor�	work_itemr
r
r�_workerEs@�

��r3c@seZdZdZdS)�BrokenThreadPoolzR
    Raised when a worker thread in a ThreadPoolExecutor failed initializing.
    N)r!r"r#�__doc__r
r
r
rr4psr4c@sdeZdZe��jZ		ddd�Zdd�Ze	j
jje_dd	�Zd
d�Z
dd
d�dd�Ze	j
jje_dS)�ThreadPoolExecutorN�r
cCs�|durtdt��pdd�}|dkrtd��|dur#t|�s#td��||_t��|_	t
�d�|_t
�|_d|_d|_t
��|_|pGd	|��|_||_||_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� ��rz"max_workers must be greater than 0zinitializer must be a callableFzThreadPoolExecutor-%d)�min�os�	cpu_count�
ValueError�callable�	TypeError�_max_workers�queue�SimpleQueue�_work_queue�	threading�	Semaphorer-�set�_threads�_brokenr�Lock�_shutdown_lock�_counter�_thread_name_prefix�_initializer�	_initargs)r�max_workersZthread_name_prefixr/r0r
r
rr{s$


�
zThreadPoolExecutor.__init__c	Os�|j�Nt�;|jrt|j��|jrtd��trtd��t��}t||||�}|j	�
|�|��|Wd�Wd�S1sDwYWd�dS1sTwYdS)Nz*cannot schedule new futures after shutdownz6cannot schedule new futures after interpreter shutdown)rKrrIr4r�RuntimeErrorrZFuturerrDr	�_adjust_thread_count)rrrr�f�wr
r
r�submit�s
R�zThreadPoolExecutor.submitcCs�|jjdd�r	dS|jfdd�}t|j�}||jkrGd|jp||f}tj|t	t
�||�|j|j|j
fd�}|��|j�|�|jt|<dSdS)Nr)�timeoutcSs|�d�dSr)r	)�_rr
r
r�
weakref_cb�sz;ThreadPoolExecutor._adjust_thread_count.<locals>.weakref_cbz%s_%d)�name�targetr)r-�acquirerD�lenrHrArMrE�Threadr3�weakref�refrNrO�start�addr)rrXZnum_threadsZthread_namerr
r
rrR�s&


�
���z'ThreadPoolExecutor._adjust_thread_countc	Cst|j�-d|_	z|j��}Wn
tjyYnw|dur'|j�t|j��qWd�dS1s3wYdS)NzBA thread initializer failed, the thread pool is not usable anymore)	rKrIrD�
get_nowaitrB�Emptyrrr4)rr2r
r
rr+�s��"�z&ThreadPoolExecutor._initializer_failedTF)�cancel_futuresc	Cs�|j�0d|_|r&	z|j��}Wn
tjyYnw|dur%|j��q
|j�d�Wd�n1s6wY|rG|j	D]}|�
�q@dSdSr)rKrrDrbrBrcr�cancelr	rHr
)r�waitrdr2rr
r
r�shutdown�s&�
�
�

�zThreadPoolExecutor.shutdown)Nr7Nr
)T)r!r"r#�	itertools�count�__next__rLrrUr�Executorr5rRr+rgr
r
r
rr6vs

�&
r6)r5�
__author__�concurrent.futuresrrhrBrEr%r^r<�WeakKeyDictionaryrrrJrr�_register_atexit�hasattrrr[�_at_fork_reinitr.�objectrr3ZBrokenExecutorr4rkr6r
r
r
r�<module>s.

�+