+
    üÐjŠ  ã                  ó¶   € R t ^ RIHt ^ RI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 ]! R	4      t]! R
4      tR R ltR tR tR tR t. ROtR# )zY
Extended thread dispatching support.

For basic support see reactor threading API docs.
)ÚannotationsN)ÚCallableÚTypeVar)Ú	ParamSpec)Údefer)ÚIReactorFromThreads)Úfailure)Ú
ThreadPoolÚ_PÚ_Rc               ó0   € V ^8„  d   QhRRRRRRRRR	R
RR/# )é   Úreactorr   Ú
threadpoolr	   ÚfzCallable[_P, _R]Úargsz_P.argsÚkwargsz	_P.kwargsÚreturnzdefer.Deferred[_R]© )Úformats   "Ú:/usr/lib/python3/dist-packages/twisted/internet/threads.pyÚ__annotate__r      sD   € ÷ 'ñ 'Ø ð'àð'ð ð'ð ð	'ð
 ð'ð ñ'ó    c                ót   a a€ \         P                  ! 4       oR VV 3R llpVP                  ! WR.VO5/ VB  S# )aó  
Call the function C{f} using a thread from the given threadpool and return
the result as a Deferred.

This function is only used by client code which is maintaining its own
threadpool.  To run a function in the reactor's threadpool, use
C{deferToThread}.

@param reactor: The reactor in whose main thread the Deferred will be
    invoked.

@param threadpool: An object which supports the C{callInThreadWithCallback}
    method of C{twisted.python.threadpool.ThreadPool}.

@param f: The function to call.
@param args: positional arguments to pass to f.
@param kwargs: keyword arguments to pass to f.

@return: A Deferred which fires a callback with the result of f, or an
    errback with a L{twisted.python.failure.Failure} if f throws an
    exception.
c               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚsuccessÚboolÚresultz_R | BaseExceptionr   ÚNoner   )r   s   "r   r   Ú'deferToThreadPool.<locals>.__annotate__9   s"   € ÷ 6ñ 6˜$ð 6Ð(:ð 6¸tñ 6r   c                óŒ   <€ V '       d   SP                  SP                  V4       R # SP                  SP                  V4       R # ©N)ÚcallFromThreadÚcallbackÚerrback)r   r   Údr   s   &&€€r   ÚonResultÚ#deferToThreadPool.<locals>.onResult9   s.   ø€ ßØ×"Ñ" 1§:¡:¨vÖ6à×"Ñ" 1§9¡9¨fÖ5r   )r   ÚDeferredÚcallInThreadWithCallback)r   r   r   r   r   r&   r%   s   f&&*, @r   ÚdeferToThreadPoolr*      s:   ù€ ô: "ŸNšNÓ,€A÷6ñ 6ð ×'Ò'¨ÐE°dÒE¸fÒEà€Hr   c                óJ   € ^ RI Hp \        W3P                  4       V .VO5/ VB # )aT  
Run a function in a thread and return the result as a Deferred.

@param f: The function to call.
@param args: positional arguments to pass to f.
@param kwargs: keyword arguments to pass to f.

@return: A Deferred which fires a callback with the result of f,
or an errback with a L{twisted.python.failure.Failure} if f throws
an exception.
©r   )Útwisted.internetr   r*   ÚgetThreadPool)r   r   r   r   s   &*, r   ÚdeferToThreadr/   D   s'   € õ )ä˜W×&;Ñ&;Ó&=¸qÐRÀ4ÒRÈ6ÑRÐRr   c                ó.   € V  F  w  rpV! V/ VB  K  	  R# )z
Run a list of functions.
Nr   )Ú	tupleListr   r   r   s   &   r   Ú_runMultipler2   U   s   € ó %‰ˆ�Ù	ˆ4Ð�6Ôó %r   c                ó>   € ^ RI Hp VP                  \        V 4       R# )zu
Run a list of functions in the same thread.

tupleList should be a list of (function, argsList, kwargsDict) tuples.
r,   N)r-   r   ÚcallInThreadr2   )r1   r   s   & r   ÚcallMultipleInThreadr5   ]   s   € õ )à×Ñœ yÖ1r   c                óì   aaaa€ \         P                   ! 4       oVVVV3R lpV P                  V4       SP                  4       p\        V\        P
                  4      '       d   VP                  4        V# )aQ  
Run a function in the reactor from a thread, and wait for the result
synchronously.  If the function returns a L{Deferred}, wait for its
result and return that.

@param reactor: The L{IReactorThreads} provider which will be used to
    schedule the function call.
@param f: the callable to run in the reactor thread
@type f: any callable.
@param a: the arguments to pass to C{f}.
@param kw: the keyword arguments to pass to C{f}.

@return: the result of the L{Deferred} returned by C{f}, or the result
    of C{f} if it returns anything other than a L{Deferred}.

@raise Exception: If C{f} raises a synchronous exception,
    C{blockingCallFromThread} will raise that exception.  If C{f}
    returns a L{Deferred} which fires with a L{Failure},
    C{blockingCallFromThread} will raise that failure's exception (see
    L{Failure.raiseException}).
c                 ór   <€ \         P                  ! S.SO5/ SB p V P                  SP                  4       R # r!   )r   ÚmaybeDeferredÚaddBothÚput)r   Úar   ÚkwÚqueues    €€€€r   Ú_callFromThreadÚ/blockingCallFromThread.<locals>._callFromThread€   s-   ø€ Ü×$Ò$ QÐ1¨Ò1¨bÑ1ˆØ�‰�u—y‘yÖ!r   )ÚQueuer"   ÚgetÚ
isinstancer   ÚFailureÚraiseException)r   r   r;   r<   r>   r   r=   s   &fjl  @r   ÚblockingCallFromThreadrE   h   sW   û€ ô, �KŠK‹M€E÷"ð "ð ×Ñ˜?Ô+Ø�Y‰Y‹[€FÜ�&œ'Ÿ/™/×*Ò*Ø×ÑÔØ€Mr   )r/   r*   r5   rE   )Ú__doc__Ú
__future__r   r=   r@   Útypingr   r   r   r-   r   Útwisted.internet.interfacesr   Útwisted.pythonr   Útwisted.python.threadpoolr	   r
   r   r*   r/   r2   r5   rE   Ú__all__r   r   r   Ú<module>rM      sY   ðñõ #ã ß $å å "Ý ;Ý "Ý 0áˆtƒ_€ÙˆTƒ]€õ'òTSò"ò2ò òF‚r   