| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/flup/server/__pycache__/ |
Upload File : |
�
#H\a� � �d � d Z dZddlZ ddlZn# e$ r ddlZY nw xY wddlZ G d� de� � ZdS )zAllan Saddi <allan@saddi.com>z
$Revision$� Nc �( � e Zd ZdZd
d�Zdd�Zd� Zd S )�
ThreadPoolz�
Thread pool that maintains the number of idle threads between
minSpare and maxSpare inclusive. By default, there is no limit on
the number of threads that can be started, but this can be controlled
by maxThreads.
� � � �� c � � || _ || _ t ||� � | _ t j � � | _ g | _ |x| _ | _ t |� � D ]}t j | j
d� � �d S )N� )� _minSpare� _maxSpare�max�_maxThreads� threading� Condition�_lock�
_workQueue�
_idleCount�_workerCount�range�thread�start_new_thread�_worker)�self�minSpare�maxSpare�
maxThreads�is �8/usr/lib/python3/dist-packages/flup/server/threadpool.py�__init__zThreadPool.__init__, s� � �!���!����x��4�4����(�*�*��
����.6�6���$�+� �x��� 6� 6�A��#�D�L�"�5�5�5�5� 6� 6� Tc �N � | j � � � | j | j k rj| j | j k rZ| xj dz
c_ | xj dz
c_ t
j | j d� � | j | j k r| j | j k �Z| j s|rO| j �
|� � | j � � � | j � � � dS | j � � � dS # | j � � � w xY w)a
Adds a job to the work queue. The job object should have a run()
method. If allowQueuing is True (the default), the job will be
added to the work queue regardless if there are any idle threads
ready. (The only way for there to be no idle threads is if maxThreads
is some reasonable, finite limit.)
Otherwise, if allowQueuing is False, and there are no more idle
threads, the job will not be queued.
Returns True if the job was queued, False otherwise.
r r TF)
r �acquirer r
r r
r r r r �append�notify�release)r �job�allowQueuings r �addJobzThreadPool.addJob9 s- � �
�
������ !��/�D�N�2�2��#�d�&6�6�6��!�!�Q�&�!�!����1�$����'���b�9�9�9� �/�D�N�2�2��#�d�&6�6�6� ��
�,�
���&�&�s�+�+�+��
�!�!�#�#�#��
�J��� � � � � � ��J��� � � � � ��D�J��� � � � ���s �B6D � D$c �r � | j � � � | j s | j � � � | j � | j � d� � }| j dk sJ �| xj dz c_ | j � � � |� � � n# Y nxY w| j � � � | j | j k rn#| xj dz
c_ | j | j k sJ ���| j | j k sJ �| xj dz c_ | j � � � dS )zN
Worker thread routine. Waits for a job, executes it, repeat.
Tr r N)
r r! r �wait�popr r$ �runr r )r r% s r r zThreadPool._workerY sM � �
�
������ 5��o�
"��
���!�!�!� �o�
"� �/�%�%�a�(�(�C��?�Q�&�&�&�&��O�O�q� �O�O��J��� � � �
���� � � � ��
� ������J��� � � ���$�.�0�0���O�O�q� �O�O��?�d�n�4�4�4�4�1 5�6 � �4�>�1�1�1�1����Q�����
�������s �B( �(B,N)r r r )T)�__name__�
__module__�__qualname__�__doc__r r'