
6	Pc           @   s   d  Z  d d l Z y d d l Z Wn e k
 rB e j e =  n Xd d l Z d d l m Z	 m
 Z d d l m Z d d l m Z d d d d	 d
 d d d d d d d d d d d d g Z e j Z e j Z e j Z e j Z [ e j d d e d d d d e Z d e f d     YZ e  a! e  a" d   Z# d    Z$ e Z% d!   Z& d" e f d#     YZ' d$   Z( d% e f d&     YZ) d'   Z* d( e f d)     YZ+ d*   Z, d+ e+ f d,     YZ- d-   Z. d. e f d/     YZ/ d0 a0 d1 d2  Z1 e   a2 i  Z3 i  Z4 d e f d3     YZ5 d4   Z6 d5 e5 f d6     YZ7 d7 e5 f d8     YZ8 d9   Z9 d: e5 f d;     YZ: d<   Z; e; Z< d=   Z= e= Z> d>   Z? d?   Z@ d d@ l mA ZA e8   jB ZC y d dA l mD ZE Wn! e k
 rd dB lF mE ZE n XdC   ZG dD   ZH e dE k reH   n  d S(F   s;   Thread module emulating a subset of Java's threading model.iN(   t   timet   sleep(   t
   format_exc(   t   dequet   activeCountt   active_countt	   Conditiont   currentThreadt   current_threadt	   enumeratet   Eventt   Lockt   RLockt	   Semaphoret   BoundedSemaphoret   Threadt   Timert
   setprofilet   settracet   localt
   stack_sizet   ignoret   categoryt   modulet	   threadingt   messages   sys.exc_cleart   _Verbosec           B   s   e  Z d d   Z d   Z RS(   c         C   s"   | d  k r t } n  | |  _ d  S(   N(   t   Nonet   _VERBOSEt   _Verbose__verbose(   t   selft   verbose(    (    s   /usr/lib/python2.7/threading.pyt   __init__:   s    	c         G   sr   |  j  rn | | } t   } y t | j } Wn t k
 rJ d | } n Xd | | f } t j j |  n  d  S(   Ns   <OS thread %d>s   %s: %s
(   R   t
   _get_identt   _activet   namet   KeyErrort   _syst   stderrt   write(   R   t   formatt   argst   identR#   (    (    s   /usr/lib/python2.7/threading.pyt   _note?   s    	
	N(   t   __name__t
   __module__R   R    R+   (    (    (    s   /usr/lib/python2.7/threading.pyR   8   s   c         C   s
   |  a  d  S(   N(   t   _profile_hook(   t   func(    (    s   /usr/lib/python2.7/threading.pyR   Y   s    c         C   s
   |  a  d  S(   N(   t   _trace_hook(   R/   (    (    s   /usr/lib/python2.7/threading.pyR   ]   s    c          O   s   t  |  |   S(   N(   t   _RLock(   R)   t   kwargs(    (    s   /usr/lib/python2.7/threading.pyR   e   s    R1   c           B   s\   e  Z d	 d   Z d   Z d d  Z e Z d   Z d   Z d   Z	 d   Z
 d   Z RS(
   c         C   s2   t  j |  |  t   |  _ d  |  _ d |  _ d  S(   Ni    (   R   R    t   _allocate_lockt   _RLock__blockR   t   _RLock__ownert   _RLock__count(   R   R   (    (    s   /usr/lib/python2.7/threading.pyR    j   s    	c         C   sH   |  j  } y t | j } Wn t k
 r- n Xd |  j j | |  j f S(   Ns   <%s owner=%r count=%d>(   R5   R"   R#   R$   t	   __class__R,   R6   (   R   t   owner(    (    s   /usr/lib/python2.7/threading.pyt   __repr__p   s    	i   c         C   s   t    } |  j | k r? |  j d |  _ |  j d |  |  d S|  j j |  } | r | |  _ d |  _ |  j d |  |  n |  j d |  |  | S(   Ni   s!   %s.acquire(%s): recursive successs   %s.acquire(%s): initial successs   %s.acquire(%s): failure(   R!   R5   R6   R+   R4   t   acquire(   R   t   blockingt   met   rc(    (    s   /usr/lib/python2.7/threading.pyR:   y   s    			c         C   sx   |  j  t   k r! t d   n  |  j d |  _ } | sd d  |  _  |  j j   |  j d |   n |  j d |   d  S(   Ns   cannot release un-acquired locki   s   %s.release(): final releases   %s.release(): non-final release(   R5   R!   t   RuntimeErrorR6   R   R4   t   releaseR+   (   R   t   count(    (    s   /usr/lib/python2.7/threading.pyR?      s    	c         C   s   |  j    d  S(   N(   R?   (   R   t   tt   vt   tb(    (    s   /usr/lib/python2.7/threading.pyt   __exit__   s    c         C   s?   | \ } } |  j  j   | |  _ | |  _ |  j d |   d  S(   Ns   %s._acquire_restore()(   R4   R:   R6   R5   R+   (   R   t   count_ownerR@   R8   (    (    s   /usr/lib/python2.7/threading.pyt   _acquire_restore   s
    		c         C   sK   |  j  d |   |  j } d |  _ |  j } d  |  _ |  j j   | | f S(   Ns   %s._release_save()i    (   R+   R6   R5   R   R4   R?   (   R   R@   R8   (    (    s   /usr/lib/python2.7/threading.pyt   _release_save   s    				c         C   s   |  j  t   k S(   N(   R5   R!   (   R   (    (    s   /usr/lib/python2.7/threading.pyt	   _is_owned   s    N(   R,   R-   R   R    R9   R:   t	   __enter__R?   RD   RF   RG   RH   (    (    (    s   /usr/lib/python2.7/threading.pyR1   h   s   						
c          O   s   t  |  |   S(   N(   t
   _Condition(   R)   R2   (    (    s   /usr/lib/python2.7/threading.pyR      s    RJ   c           B   st   e  Z d d d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d d  Z
 d d	  Z d
   Z e Z RS(   c         C   s   t  j |  |  | d  k r( t   } n  | |  _ | j |  _ | j |  _ y | j |  _ Wn t k
 rl n Xy | j	 |  _	 Wn t k
 r n Xy | j
 |  _
 Wn t k
 r n Xg  |  _ d  S(   N(   R   R    R   R   t   _Condition__lockR:   R?   RG   t   AttributeErrorRF   RH   t   _Condition__waiters(   R   t   lockR   (    (    s   /usr/lib/python2.7/threading.pyR       s&    	c         C   s   |  j  j   S(   N(   RK   RI   (   R   (    (    s   /usr/lib/python2.7/threading.pyRI      s    c         G   s   |  j  j |   S(   N(   RK   RD   (   R   R)   (    (    s   /usr/lib/python2.7/threading.pyRD      s    c         C   s   d |  j  t |  j  f S(   Ns   <Condition(%s, %d)>(   RK   t   lenRM   (   R   (    (    s   /usr/lib/python2.7/threading.pyR9      s    c         C   s   |  j  j   d  S(   N(   RK   R?   (   R   (    (    s   /usr/lib/python2.7/threading.pyRG      s    c         C   s   |  j  j   d  S(   N(   RK   R:   (   R   t   x(    (    s   /usr/lib/python2.7/threading.pyRF      s    c         C   s+   |  j  j d  r# |  j  j   t St Sd  S(   Ni    (   RK   R:   R?   t   Falset   True(   R   (    (    s   /usr/lib/python2.7/threading.pyRH      s    c         C   sY  |  j    s t d   n  t   } | j   |  j j |  |  j   } z | d  k rv | j   |  j d |   n t	   | } d } x` t
 r | j d  } | r Pn  | t	   } | d k r Pn  t | d | d  } t |  q W| s0|  j d |  |  y |  j j |  WqCt k
 r,qCXn |  j d |  |  Wd  |  j |  Xd  S(	   Ns   cannot wait on un-acquired locks   %s.wait(): got itgMb@?i    i   g?s   %s.wait(%s): timed outs   %s.wait(%s): got it(   RH   R>   R3   R:   RM   t   appendRG   R   R+   t   _timeRR   t   mint   _sleept   removet
   ValueErrorRF   (   R   t   timeoutt   waitert   saved_statet   endtimet   delayt   gotitt	   remaining(    (    s   /usr/lib/python2.7/threading.pyt   wait   s:    	

	i   c         C   s   |  j    s t d   n  |  j } | |  } | sH |  j d |   d  S|  j d |  | | d k ri d pl d  x= | D]5 } | j   y | j |  Wqw t k
 r qw Xqw Wd  S(   Ns!   cannot notify on un-acquired locks   %s.notify(): no waiterss"   %s.notify(): notifying %d waiter%si   t   st    (   RH   R>   RM   R+   R?   RW   RX   (   R   t   nRM   t   waitersRZ   (    (    s   /usr/lib/python2.7/threading.pyt   notify  s    	

c         C   s   |  j  t |  j   d  S(   N(   Re   RO   RM   (   R   (    (    s   /usr/lib/python2.7/threading.pyt	   notifyAll'  s    N(   R,   R-   R   R    RI   RD   R9   RG   RF   RH   R`   Re   Rf   t
   notify_all(    (    (    s   /usr/lib/python2.7/threading.pyRJ      s   							*	c          O   s   t  |  |   S(   N(   t
   _Semaphore(   R)   R2   (    (    s   /usr/lib/python2.7/threading.pyR   -  s    Rh   c           B   s;   e  Z d  d d  Z d  d  Z e Z d   Z d   Z RS(   i   c         C   sJ   | d k  r t  d   n  t j |  |  t t    |  _ | |  _ d  S(   Ni    s$   semaphore initial value must be >= 0(   RX   R   R    R   R   t   _Semaphore__condt   _Semaphore__value(   R   t   valueR   (    (    s   /usr/lib/python2.7/threading.pyR    4  s
    c         C   s   t  } |  j j   xo |  j d k rX | s/ Pn  |  j d |  | |  j  |  j j   q W|  j d |  _ |  j d |  |  j  t } |  j j   | S(   Ni    s)   %s.acquire(%s): blocked waiting, value=%si   s   %s.acquire: success, value=%s(   RQ   Ri   R:   Rj   R+   R`   RR   R?   (   R   R;   R=   (    (    s   /usr/lib/python2.7/threading.pyR:   ;  s    		c         C   sQ   |  j  j   |  j d |  _ |  j d |  |  j  |  j  j   |  j  j   d  S(   Ni   s   %s.release: success, value=%s(   Ri   R:   Rj   R+   Re   R?   (   R   (    (    s   /usr/lib/python2.7/threading.pyR?   P  s    	c         C   s   |  j    d  S(   N(   R?   (   R   RA   RB   RC   (    (    s   /usr/lib/python2.7/threading.pyRD   Y  s    N(   R,   R-   R   R    R:   RI   R?   RD   (    (    (    s   /usr/lib/python2.7/threading.pyRh   0  s
   		c          O   s   t  |  |   S(   N(   t   _BoundedSemaphore(   R)   R2   (    (    s   /usr/lib/python2.7/threading.pyR   ]  s    Rl   c           B   s&   e  Z d  Z d d d  Z d   Z RS(   s6   Semaphore that checks that # releases is <= # acquiresi   c         C   s    t  j |  | |  | |  _ d  S(   N(   Rh   R    t   _initial_value(   R   Rk   R   (    (    s   /usr/lib/python2.7/threading.pyR    b  s    c         C   s+   |  j  |  j k r t d  n  t j |   S(   Ns!   Semaphore released too many times(   Rj   Rm   RX   Rh   R?   (   R   (    (    s   /usr/lib/python2.7/threading.pyR?   f  s    N(   R,   R-   t   __doc__R   R    R?   (    (    (    s   /usr/lib/python2.7/threading.pyRl   `  s   c          O   s   t  |  |   S(   N(   t   _Event(   R)   R2   (    (    s   /usr/lib/python2.7/threading.pyR
   l  s    Ro   c           B   sJ   e  Z d d   Z d   Z d   Z e Z d   Z d   Z d d  Z	 RS(   c         C   s/   t  j |  |  t t    |  _ t |  _ d  S(   N(   R   R    R   R   t   _Event__condRQ   t   _Event__flag(   R   R   (    (    s   /usr/lib/python2.7/threading.pyR    s  s    c         C   s   |  j  j   d  S(   N(   Rp   R    (   R   (    (    s   /usr/lib/python2.7/threading.pyt   _reset_internal_locksx  s    c         C   s   |  j  S(   N(   Rq   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   isSet|  s    c         C   s<   |  j  j   z t |  _ |  j  j   Wd  |  j  j   Xd  S(   N(   Rp   R:   RR   Rq   Rg   R?   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   set  s
    	c         C   s/   |  j  j   z t |  _ Wd  |  j  j   Xd  S(   N(   Rp   R:   RQ   Rq   R?   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   clear  s    c         C   sI   |  j  j   z' |  j s, |  j  j |  n  |  j SWd  |  j  j   Xd  S(   N(   Rp   R:   Rq   R`   R?   (   R   RY   (    (    s   /usr/lib/python2.7/threading.pyR`     s    	N(
   R,   R-   R   R    Rr   Rs   t   is_setRt   Ru   R`   (    (    (    s   /usr/lib/python2.7/threading.pyRo   o  s   				i    s	   Thread-%dc         C   s   t  d a  |  t  S(   Ni   (   t   _counter(   t   template(    (    s   /usr/lib/python2.7/threading.pyt   _newname  s    
c           B   s4  e  Z e Z e j Z e j Z d d d d d d d   Z
 d   Z e d    Z d   Z d   Z d   Z d   Z d   Z d   Z d	   Z d
   Z d   Z d d  Z e d    Z e j d    Z e d    Z d   Z e Z e d    Z e j d    Z d   Z d   Z d   Z  d   Z! RS(   c         C   s   | d  k s t d  t j |  |  | d  k r: i  } n  | |  _ t | pR t    |  _ | |  _ | |  _	 |  j
   |  _ d  |  _ t   |  _ t |  _ t t    |  _ t |  _ t j |  _ d  S(   Ns#   group argument must be None for now(   R   t   AssertionErrorR   R    t   _Thread__targett   strRy   t   _Thread__namet   _Thread__argst   _Thread__kwargst   _set_daemont   _Thread__daemonict   _Thread__identR
   t   _Thread__startedRQ   t   _Thread__stoppedR   R   t   _Thread__blockRR   t   _Thread__initializedR%   R&   t   _Thread__stderr(   R   t   groupt   targetR#   R)   R2   R   (    (    s   /usr/lib/python2.7/threading.pyR      s    							c         C   s0   t  |  d  r |  j j   n  |  j j   d  S(   NR   (   t   hasattrR   R    R   Rr   (   R   (    (    s   /usr/lib/python2.7/threading.pyRr     s    c         C   s   |  j  S(   N(   R   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   _block  s    c         C   s
   t    j S(   N(   R   t   daemon(   R   (    (    s   /usr/lib/python2.7/threading.pyR     s    c         C   s   |  j  s t d  d } |  j j   r0 d } n  |  j rB d } n  |  j rX | d 7} n  |  j d  k	 r{ | d |  j 7} n  d |  j j	 |  j
 | f S(   Ns    Thread.__init__() was not calledt   initialt   startedt   stoppeds    daemons    %ss   <%s(%s, %s)>(   R   Rz   R   Rv   R   R   R   R   R7   R,   R}   (   R   t   status(    (    s   /usr/lib/python2.7/threading.pyR9     s    				c         C   s   |  j  s t d   n  |  j j   r6 t d   n  |  j d |   t  |  t |  <Wd  QXy t |  j d  Wn( t	 k
 r t  t |  =Wd  QX  n X|  j j
   d  S(   Ns   thread.__init__() not calleds    threads can only be started onces   %s.start(): starting thread(    (   R   R>   R   Rv   R+   t   _active_limbo_lockt   _limbot   _start_new_threadt   _Thread__bootstrapt	   ExceptionR`   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   start  s    	c         C   s@   z& |  j  r% |  j  |  j |  j   n  Wd  |  `  |  ` |  ` Xd  S(   N(   R{   R~   R   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   run  s    	c         C   s8   y |  j    Wn# |  j r- t d  k r- d  S  n Xd  S(   N(   t   _Thread__bootstrap_innerR   R%   R   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   __bootstrap  s    c         C   s   t    |  _ d  S(   N(   R!   R   (   R   (    (    s   /usr/lib/python2.7/threading.pyt
   _set_ident  s    c      
   C   s	  z|  j    |  j j   t  |  t |  j <t |  =Wd  QX|  j d |   t rq |  j d |   t	 j
 t  n  t r |  j d |   t	 j t  n  z,y |  j   Wnt k
 r |  j d |   n |  j d |   t	 rt	 j j d |  j t   f  q|  j   \ } } } z |  j d |  j d IJ|  j d	 IJxB | r|  j d
 | j j j | j | j j j f IJ| j } qGW|  j d | | f IJWd  ~ ~ ~ Xn X|  j d |   Wd  |  j   XWd  t ' |  j   y t t   =Wn n XWd  QXXd  S(   Ns    %s.__bootstrap(): thread starteds(   %s.__bootstrap(): registering trace hooks*   %s.__bootstrap(): registering profile hooks#   %s.__bootstrap(): raised SystemExits%   %s.__bootstrap(): unhandled exceptions   Exception in thread %s:
%s
s   Exception in thread s2    (most likely raised during interpreter shutdown):s"   Traceback (most recent call last):s     File "%s", line %s, in %ss   %s: %ss   %s.__bootstrap(): normal return(   R   R   Rt   R   R"   R   R   R+   R0   R%   R   R.   R   R   t
   SystemExitR&   R'   R#   t   _format_exct   _Thread__exc_infoR   t   tb_framet   f_codet   co_filenamet	   tb_linenot   co_namet   tb_nextt   _Thread__exc_cleart   _Thread__stopR!   (   R   t   exc_typet	   exc_valuet   exc_tb(    (    s   /usr/lib/python2.7/threading.pyt   __bootstrap_inner  s^    
 
	
c         C   s4   |  j  j   t |  _ |  j  j   |  j  j   d  S(   N(   R   R:   RR   R   Rg   R?   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   __stop`  s    	c         C   sH   y t   t t   =Wd QXWn& t k
 rC d t j k rD   qD n Xd S(   sA   Remove current thread from the dict of currently running threads.Nt   dummy_threading(   R   R"   R!   R$   R%   t   modules(   R   (    (    s   /usr/lib/python2.7/threading.pyt   __deletef  s    c         C   s<  |  j  s t d   n  |  j j   s6 t d   n  |  t   k rT t d   n  |  j sp |  j d |   n  |  j j   z | d  k r x |  j s |  j j
   q W|  j d |   nj t   | } xZ |  j s| t   } | d k r|  j d |   Pn  |  j j
 |  q W|  j d |   Wd  |  j j   Xd  S(   Ns   Thread.__init__() not calleds'   cannot join thread before it is starteds   cannot join current threads%   %s.join(): waiting until thread stopss   %s.join(): thread stoppedi    s   %s.join(): timed out(   R   R>   R   Rv   R   R   R+   R   R:   R   R`   RT   R?   (   R   RY   t   deadlineR]   (    (    s   /usr/lib/python2.7/threading.pyt   join  s.    		c         C   s   |  j  s t d  |  j S(   Ns   Thread.__init__() not called(   R   Rz   R}   (   R   (    (    s   /usr/lib/python2.7/threading.pyR#     s    c         C   s%   |  j  s t d  t |  |  _ d  S(   Ns   Thread.__init__() not called(   R   Rz   R|   R}   (   R   R#   (    (    s   /usr/lib/python2.7/threading.pyR#     s    c         C   s   |  j  s t d  |  j S(   Ns   Thread.__init__() not called(   R   Rz   R   (   R   (    (    s   /usr/lib/python2.7/threading.pyR*     s    c         C   s)   |  j  s t d  |  j j   o( |  j S(   Ns   Thread.__init__() not called(   R   Rz   R   Rv   R   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   isAlive  s    c         C   s   |  j  s t d  |  j S(   Ns   Thread.__init__() not called(   R   Rz   R   (   R   (    (    s   /usr/lib/python2.7/threading.pyR     s    c         C   sC   |  j  s t d   n  |  j j   r6 t d   n  | |  _ d  S(   Ns   Thread.__init__() not calleds)   cannot set daemon status of active thread(   R   R>   R   Rv   R   (   R   t   daemonic(    (    s   /usr/lib/python2.7/threading.pyR     s
    	c         C   s   |  j  S(   N(   R   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   isDaemon  s    c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s   /usr/lib/python2.7/threading.pyt	   setDaemon  s    c         C   s   |  j  S(   N(   R#   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   getName  s    c         C   s   | |  _  d  S(   N(   R#   (   R   R#   (    (    s   /usr/lib/python2.7/threading.pyt   setName  s    N(    ("   R,   R-   RQ   R   R%   t   exc_infoR   t	   exc_clearR   R   R    Rr   t   propertyR   R   R9   R   R   R   R   R   R   t   _Thread__deleteR   R#   t   setterR*   R   t   is_aliveR   R   R   R   R   (    (    (    s   /usr/lib/python2.7/threading.pyR     s8   												J		#!				c          O   s   t  |  |   S(   N(   t   _Timer(   R)   R2   (    (    s   /usr/lib/python2.7/threading.pyR     s    R   c           B   s/   e  Z d  Z g  i  d  Z d   Z d   Z RS(   s   Call a function after a specified number of seconds:

    t = Timer(30.0, f, args=[], kwargs={})
    t.start()
    t.cancel() # stop the timer's action if it's still waiting
    c         C   sA   t  j |   | |  _ | |  _ | |  _ | |  _ t   |  _ d  S(   N(   R   R    t   intervalt   functionR)   R2   R
   t   finished(   R   R   R   R)   R2   (    (    s   /usr/lib/python2.7/threading.pyR      s    				c         C   s   |  j  j   d S(   s(   Stop the timer if it hasn't finished yetN(   R   Rt   (   R   (    (    s   /usr/lib/python2.7/threading.pyt   cancel  s    c         C   sL   |  j  j |  j  |  j  j   s; |  j |  j |  j   n  |  j  j   d  S(   N(   R   R`   R   Rv   R   R)   R2   Rt   (   R   (    (    s   /usr/lib/python2.7/threading.pyR     s    (   R,   R-   Rn   R    R   R   (    (    (    s   /usr/lib/python2.7/threading.pyR     s   	t   _MainThreadc           B   s#   e  Z d    Z d   Z d   Z RS(   c         C   sH   t  j |  d d |  j j   |  j   t  |  t t   <Wd  QXd  S(   NR#   t
   MainThread(   R   R    R   Rt   R   R   R"   R!   (   R   (    (    s   /usr/lib/python2.7/threading.pyR      s
    
c         C   s   t  S(   N(   RQ   (   R   (    (    s   /usr/lib/python2.7/threading.pyR     s    c         C   sj   |  j    t   } | r, |  j d |   n  x | rK | j   t   } q/ W|  j d |   |  j   d  S(   Ns   %s: waiting for other threadss   %s: exiting(   R   t   _pickSomeNonDaemonThreadR+   R   R   (   R   RA   (    (    s   /usr/lib/python2.7/threading.pyt	   _exitfunc  s    
		
(   R,   R-   R    R   R   (    (    (    s   /usr/lib/python2.7/threading.pyR     s   		c          C   s2   x+ t    D]  }  |  j r
 |  j   r
 |  Sq
 Wd  S(   N(   R	   R   R   R   (   RA   (    (    s   /usr/lib/python2.7/threading.pyR     s    t   _DummyThreadc           B   s&   e  Z d    Z d   Z d d  Z RS(   c         C   sT   t  j |  d t d  |  ` |  j j   |  j   t  |  t t	   <Wd  QXd  S(   NR#   s   Dummy-%d(
   R   R    Ry   R   R   Rt   R   R   R"   R!   (   R   (    (    s   /usr/lib/python2.7/threading.pyR    $  s    
c         C   s   t  S(   N(   RR   (   R   (    (    s   /usr/lib/python2.7/threading.pyR   1  s    c         C   s   t  s t d  d  S(   Ns   cannot join a dummy thread(   RQ   Rz   (   R   RY   (    (    s   /usr/lib/python2.7/threading.pyR   4  s    N(   R,   R-   R    R   R   R   (    (    (    s   /usr/lib/python2.7/threading.pyR   "  s   		c           C   s+   y t  t   SWn t k
 r& t   SXd  S(   N(   R"   R!   R$   R   (    (    (    s   /usr/lib/python2.7/threading.pyR   :  s    c           C   s%   t   t t  t t  SWd  QXd  S(   N(   R   RO   R"   R   (    (    (    s   /usr/lib/python2.7/threading.pyR   C  s    c           C   s   t  j   t j   S(   N(   R"   t   valuesR   (    (    (    s   /usr/lib/python2.7/threading.pyt
   _enumerateI  s    c           C   s%   t   t j   t j   SWd  QXd  S(   N(   R   R"   R   R   (    (    (    s   /usr/lib/python2.7/threading.pyR	   M  s    (   R   (   t   _local(   R   c          C   s   t    a i  }  t   } t  xd t j   D]V } | | k ry t   } | | _ t | d  rl | j   n  | |  | <q, t	 | _
 q, Wt j   t j   t j |   t t  d k s t  Wd  QXd  S(   NRr   i   (   R3   R   R   R"   t
   itervaluesR!   R   R   Rr   RR   R   R   Ru   t   updateRO   Rz   (   t
   new_activet   currentt   threadR*   (    (    s   /usr/lib/python2.7/threading.pyt   _after_forkb  s     				

c          C   s  d t  f d     Y}  d t f d     Y} d t f d     Y} d } d } d	 } |  |  } g  } xA t |  D]3 } | | |  }	 d
 | d |	 _ | j |	  qs W| | | |  }
 x" | D] }	 |	 j   t d  q W|
 j   x | D] }	 |	 j   q W|
 j   d  S(   Nt   BoundedQueuec           B   s#   e  Z d    Z d   Z d   Z RS(   c         S   sV   t  j |   t   |  _ t |  j  |  _ t |  j  |  _ | |  _ t   |  _	 d  S(   N(
   R   R    R   t   monR   R=   t   wct   limitR   t   queue(   R   R   (    (    s   /usr/lib/python2.7/threading.pyR      s    	c         S   s   |  j  j   x9 t |  j  |  j k rH |  j d |  |  j j   q W|  j j |  |  j d | t |  j   |  j	 j
   |  j  j   d  S(   Ns   put(%s): queue fulls    put(%s): appended, length now %d(   R   R:   RO   R   R   R+   R   R`   RS   R=   Re   R?   (   R   t   item(    (    s   /usr/lib/python2.7/threading.pyt   put  s    	c         S   s   |  j  j   x' |  j s6 |  j d  |  j j   q W|  j j   } |  j d | t |  j   |  j j	   |  j  j
   | S(   Ns   get(): queue emptys   get(): got %s, %d left(   R   R:   R   R+   R=   R`   t   popleftRO   R   Re   R?   (   R   R   (    (    s   /usr/lib/python2.7/threading.pyt   get  s    (   R,   R-   R    R   R   (    (    (    s   /usr/lib/python2.7/threading.pyR     s   		t   ProducerThreadc           B   s   e  Z d    Z d   Z RS(   c         S   s)   t  j |  d d | |  _ | |  _ d  S(   NR#   t   Producer(   R   R    R   t   quota(   R   R   R   (    (    s   /usr/lib/python2.7/threading.pyR      s    	c         S   sh   d d l  m  } d } xK | |  j k  rc | d } |  j j d |  j | f  t |   d  q Wd  S(   Ni(   t   randomi    i   s   %s.%dgh㈵>(   R   R   R   R   R#   RV   (   R   R   t   counter(    (    s   /usr/lib/python2.7/threading.pyR     s    
(   R,   R-   R    R   (    (    (    s   /usr/lib/python2.7/threading.pyR     s   	t   ConsumerThreadc           B   s   e  Z d    Z d   Z RS(   c         S   s)   t  j |  d d | |  _ | |  _ d  S(   NR#   t   Consumer(   R   R    R   R@   (   R   R   R@   (    (    s   /usr/lib/python2.7/threading.pyR      s    	c         S   s>   x7 |  j  d k r9 |  j j   } | GH|  j  d |  _  q Wd  S(   Ni    i   (   R@   R   R   (   R   R   (    (    s   /usr/lib/python2.7/threading.pyR     s    (   R,   R-   R    R   (    (    (    s   /usr/lib/python2.7/threading.pyR     s   	i   i   i   s   Producer-%di   gư>(   R   R   t   rangeR#   RS   R   RV   R   (   R   R   R   t   NPt   QLt   NIt   Qt   Pt   iRA   t   C(    (    s   /usr/lib/python2.7/threading.pyt   _test  s(     

t   __main__(I   Rn   t   sysR%   R   t   ImportErrorR   R,   t   warningsR    RT   R   RV   t	   tracebackR   R   t   collectionsR   t   __all__t   start_new_threadR   t   allocate_lockR3   t	   get_identR!   t   errort   ThreadErrort   filterwarningst   DeprecationWarningRQ   R   t   objectR   R   R.   R0   R   R   R   R   R1   R   RJ   R   Rh   R   Rl   R
   Ro   Rw   Ry   R   R"   R   R   R   R   R   R   R   R   R   R   R   R   R	   R   R   t	   _shutdownR   R   t   _threading_localR   R   (    (    (    s   /usr/lib/python2.7/threading.pyt   <module>   s   
								M	u	-		+	 3							(	R