Repository URL to install this package:
|
Version:
3.4.52 ▾
|
ó
EYc @ s© d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d g Z e Z d e
f d YZ d Z d e
f d YZ
d
e
f d YZ d S( iÿÿÿÿN( t queue( t greenlets( t sixt GreenPoolt GreenPilec B s e Z d Z d d Z d Z d Z d Z d Z d Z d Z d Z
d
Z d Z d Z
d
Z d Z RS( s4 The GreenPool class is a pool of green threads.
iè c C sº y t | } Wn= t k
rO } d j t | t | } t | n X| d k r d j t | } t | n | | _ t | _ t
j | | _ t
j
| _ d S( Ns/ GreenPool() expect size :: int, actual: {0} {1}i s) GreenPool() expect size >= 0, actual: {0}( t intt
ValueErrort formatt typet strt TypeErrort reprt sizet sett coroutines_runningt eventlett Semaphoret semt Eventt no_coros_running( t selfR t et msg( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/greenpool.pyt __init__ s c C s, | | j } | j j | 7_ | | _ d S( s½ Change the max number of greenthreads doing work at any given time.
If resize is called when there are more than *new_size* greenthreads
already working on tasks, they will be allowed to complete but no new
tasks will be allowed to get launched until enough greenthreads finish
their tasks to drop the overall quantity below *new_size*. Until
then, the return value of free() will be negative.
N( R R t counter( R t new_sizet
size_delta( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/greenpool.pyt resize s
c C s
t | j S( sd Returns the number of greenthreads that are currently executing
functions in the GreenPool.( t lenR ( R ( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/greenpool.pyt running, s c C s
| j j S( sÍ Returns the number of greenthreads available for use.
If zero or less, the next call to :meth:`spawn` or :meth:`spawn_n` will
block the calling greenthread until a slot becomes available.( R R ( R ( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/greenpool.pyt free1 s c O s´ t j } | j j rS | | j k rS t j j | } | j | | | | S| j j t j | | | } | j s t j
| _ n | j j | | j
| j | S( s
Run the *function* with its arguments in its own green thread.
Returns the :class:`GreenThread <eventlet.GreenThread>`
object that is running the function, which can be used to retrieve the
results.
If the pool is currently at capacity, ``spawn`` will block until one of
the running greenthreads completes its task and frees up a slot.
This function is reentrant; *function* can call ``spawn`` on the same
pool without risk of deadlocking the whole thing.
( R t
getcurrentR t lockedR t greenthreadt GreenThreadt maint acquiret spawnR R t addt linkt _spawn_done( R t functiont argst kwargst currentt gt( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/greenpool.pyR% 8 s
c C s zQ y | | | Wn9 t t t j f k
r6 n t rP t j qP n XWd | d k rd d St j } | j
| Xd S( N( t KeyboardInterruptt
SystemExitt greenlett GreenletExitt DEBUGt tracebackt print_exct NoneR R R( ( R t funcR* R+ t coro( ( sG /home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/greenpool.pyt
_spawn_n_implU s c O s t j } | j j rC | | j k rC | j | | | d nV | j j t j | j | | | t } | j s t j
| _ n | j j | d S( sÄ Create a greenthread to run the *function*, the same as
:meth:`spawn`. The difference is that :meth:`spawn_n` returns
None; the results of *function* are not retrievable.
N(
R R R R R R8 R5 R$ t spawn_nt TrueR R R&