+
    Dfj
                         R t ^ RIHt ^ RIHtHtHt ^ RIH	t	H
t
 ^ RIHt ^ RIHt ^RIHt ^RIHt ^RIHtHt  ! R	 R
]4      t]3R R lltR# )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                   2   a  ] tR t^t o V 3R lR ltRtV tR# )_ThreadFactoryc                :   < V ^8  d   QhRS[ RS[3,          RS[/# )   target.return)r   objectr   )format__classdict__s   "8/usr/lib/python3/dist-packages/twisted/_threads/_pool.py__annotate___ThreadFactory.__annotate__   s$      (3;"7 F     c                   R # N )selfr   s   &$r   __call___ThreadFactory.__call__   s    r   r   N)__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell__)r   s   @r   r   r      s      r   r   c                V    V ^8  d   QhR\         . \        3,          R\        R\        /# )r   currentLimitthreadFactoryr   )r   intr   r   )r   s   "r   r   r      s-     - -2s7#-4B-	-r   c                   a aaa R V3R lloR V VV3R llp\        \        \        4       \        4       4      V\        R7      oS# )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}.
c                B    V ^8  d   QhR\         R\        3,          RR/# )r   r   .r   N)r   r   )r   s   "r   r   pool.<locals>.__annotate__;   s#     4 4HS&[1 4d 4r   c                 2   < S! V R 7      P                  4       # ))r   )start)r   r)   s   &r   startThreadpool.<locals>.startThread;   s    F+1133r   c                :    V ^8  d   QhR\         \        ,          /# )r   r   )r   r
   )r   s   "r   r   r-   >   s     2 2(7"3 2r   c                     < SP                  4       p V P                  V P                  ,           S! 4       8  d   R # \        S\	        4       4      # r   )
statisticsbusyWorkerCountidleWorkerCountr   r   )statsr(   r0   teams    r   limitedWorkerCreator"pool.<locals>.limitedWorkerCreator>   s<    !  5#8#88LNJK11r   )coordinatorcreateWorkerlogException)r   r   r   LocalStorager	   )r(   r)   r9   r0   r8   s   ff @@r   poolr?      s>    >4 42 2 tv|~6)D
 Kr   N)__doc__queuer   	threadingr   r   r   r>   typingr   r   r   twisted.python.logr	   	_ithreadsr
   _teamr   _threadworkerr   r   r   r?   r   r   r   <module>rH      sD   
  9 9 %  "   3X  FL- -r   