ó ;H,]c@sùdZddlZddlmZddlZddlZddlZddlZddl Z yddl m Z Wne k rŽd„Z nXdZ ejƒZead„Zejeƒdefd „ƒYZd „Zd ejfd „ƒYZdS( sImplements ThreadPoolExecutor.iÿÿÿÿN(t_base(t cpu_countcCsdS(N(tNone(((sD/opt/awscli/lib/python2.7/site-packages/concurrent/futures/thread.pyRss"Brian Quinlan (brian@sweetapp.com)cCsstatrttjƒƒnd}x!|D]\}}|jdƒq+Wx$|D]\}}|jtj ƒqOWdS(N(( tTruet _shutdownt_threads_queuestlisttitemstputRtjointsystmaxint(Rtttq((sD/opt/awscli/lib/python2.7/site-packages/concurrent/futures/thread.pyt _python_exit(s t _WorkItemcBseZd„Zd„ZRS(cCs(||_||_||_||_dS(N(tfuturetfntargstkwargs(tselfRRRR((sD/opt/awscli/lib/python2.7/site-packages/concurrent/futures/thread.pyt__init__4s   cCsv|jjƒsdSy|j|j|jŽ}Wn0tjƒd\}}|jj||ƒnX|jj|ƒdS(Ni( Rtset_running_or_notify_cancelRRRR texc_infotset_exception_infot set_result(Rtresulttettb((sD/opt/awscli/lib/python2.7/site-packages/concurrent/futures/thread.pytrun:s(t__name__t __module__RR(((sD/opt/awscli/lib/python2.7/site-packages/concurrent/futures/thread.pyR3s cCsÆy¢x›tr |jdtƒ}|dk re|jƒ~|ƒ}|dk r\|jjƒn~qn|ƒ}ts‰|dks‰|jrš|jdƒdS~qWWntj j ddtƒnXdS(NtblocksException in workerR( RtgetRRt_idle_semaphoretreleaseRRRtLOGGERtcritical(texecutor_referencet work_queuet work_itemtexecutor((sD/opt/awscli/lib/python2.7/site-packages/concurrent/futures/thread.pyt_workerFs$        tThreadPoolExecutorcBsheZejƒjZddd„Zd„Ze j jj e_ d„Z e d„Ze j jj e_ RS(tcCs¨|dkr"tƒpdd}n|dkr=tdƒ‚n||_tjƒ|_tjdƒ|_ t ƒ|_ t |_ tjƒ|_|pžd|jƒ|_dS(sInitializes a new ThreadPoolExecutor instance. Args: max_workers: The maximum number of threads that can be used to execute the given calls. thread_name_prefix: An optional name prefix to give our threads. iiis"max_workers must be greater than 0sThreadPoolExecutor-%dN(RRt ValueErrort _max_workerstqueuetQueuet _work_queuet threadingt SemaphoreR"tsett_threadstFalseRtLockt_shutdown_lockt_countert_thread_name_prefix(Rt max_workerstthread_name_prefix((sD/opt/awscli/lib/python2.7/site-packages/concurrent/futures/thread.pyRhs     c Osk|j\|jr"tdƒ‚ntjƒ}t||||ƒ}|jj|ƒ|jƒ|SWdQXdS(Ns*cannot schedule new futures after shutdown( R8Rt RuntimeErrorRtFutureRR1Rt_adjust_thread_count(RRRRtftw((sD/opt/awscli/lib/python2.7/site-packages/concurrent/futures/thread.pytsubmit€s    c CsÆ|jjtƒrdS|jd„}t|jƒ}||jkrÂd|jpR||f}tj d|dt dt j ||ƒ|jfƒ}t |_|jƒ|jj|ƒ|jt|s&