ó
    Ö›‘h"
  ã                   ó´   • S r SSKJr  SSKJrJrJr  SSKJ	r	J
r
  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJrJr   " S S\5      r\4S\	/ \4   S\S\4S jjrg)zR
Top level thread pool interface, used to implement
L{twisted.python.threadpool}.
é    )ÚQueue)ÚLockÚThreadÚlocal)ÚCallableÚOptional)ÚProtocol)Úerré   )ÚIWorker)ÚTeam)Ú
LockWorkerÚThreadWorkerc                   ó0   • \ rS rSrS\S\4   S\4S jrSrg)Ú_ThreadFactoryé   Útarget.Úreturnc                ó   • g ©N© )Úselfr   s     ÚZC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/_threads/_pool.pyÚ__call__Ú_ThreadFactory.__call__   s   € Øó    r   N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Úobjectr   r   Ú__static_attributes__r   r   r   r   r      s   † ð (¨3°¨;Ñ"7ð ¸F÷ r   r   ÚcurrentLimitÚthreadFactoryr   c                 óÀ   ^ ^^^• S[         S[        4   SS4U4S jjmS[        [           4U UU4S jjn[	        [        [        5       [        5       5      U[        S9mT$ )aã  
Construct a L{Team} that spawns threads as a thread pool, with the given
limiting function.

@note: Future maintainers: while the public API for the eventual move to
    twisted.threads should look I{something} like this, and while this
    function is necessary to implement the API described by
    L{twisted.python.threadpool}, I am starting to think the idea of a hard
    upper limit on threadpool size is just bad (turning memory performance
    issues into correctness issues well before we run into memory
    pressure), and instead we should build something with reactor
    integration for slowly releasing idle threads when they're not needed
    and I{rate} limiting the creation of new threads rather than just
    hard-capping it.

@param currentLimit: a callable that returns the current limit on the
    number of workers that the returned L{Team} should create; if it
    already has more workers than that value, no new workers will be
    created.
@type currentLimit: 0-argument callable returning L{int}

@param threadFactory: Factory that, when given a C{target} keyword argument,
    returns a L{threading.Thread} that will run that target.
@type threadFactory: callable returning a L{threading.Thread}

@return: a new L{Team}.
r   .r   Nc                 ó,   >• T" U S9R                  5       $ )N)r   )Ústart)r   r$   s    €r   ÚstartThreadÚpool.<locals>.startThread;   s   ø€ Ù FÑ+×1Ñ1Ó3Ð3r   c                  ó’   >• TR                  5       n U R                  U R                  -   T" 5       :¼  a  g [        T[	        5       5      $ r   )Ú
statisticsÚbusyWorkerCountÚidleWorkerCountr   r   )Ústatsr#   r(   Úteams    €€€r   ÚlimitedWorkerCreatorÚ"pool.<locals>.limitedWorkerCreator>   s<   ø€ Ø—‘Ó!ˆØ× Ñ  5×#8Ñ#8Ñ8¹L»NÓJØÜ˜K¬«Ó1Ð1r   )ÚcoordinatorÚcreateWorkerÚlogException)	r   r!   r   r   r   r   r   ÚLocalStorager
   )r#   r$   r0   r(   r/   s   `` @@r   Úpoolr6      s\   û€ ð>4œH S¬& [Ñ1ð 4°d÷ 4ð2¤(¬7Ñ"3÷ 2ñ 2ô Üœt›v¤|£~Ó6Ø)Üñ€Dð
 €Kr   N)Ú__doc__Úqueuer   Ú	threadingr   r   r   r5   Útypingr   r   Útyping_extensionsr	   Útwisted.python.logr
   Ú	_ithreadsr   Ú_teamr   Ú_threadworkerr   r   r   Úintr6   r   r   r   Ú<module>rA      s`   ðñ
õ ß 9Ñ 9ß %å &å "Ý Ý ß 3ô�Xô ð FLñ-Ø˜2˜s˜7Ñ#ð-Ø4Bð-à	ö-r   