
    i?                     0   d Z ddlZddlmZ ddlmZ ddlmZ g dZeddgz  Zej	        
                    d	          Ze                                Zdaej	                            d	 e            d
efdef           da G d d          Zdad Zd ZeZdS )z=Implements the standard threading module, using greenthreads.    N)thread)time)	greenlets)Lock_allocate_lock_get_main_thread_ident_make_thread_handle	_shutdown_sleep_start_joinable_thread_start_new_thread_ThreadHandlecurrentThreadcurrent_threadlocal
stack_size_active_limbo	get_ident_set_sentinel	threading_threadr      c                       e Zd ZdZd Zd ZddZd ZeZd Z	e	Z
 eee	          Z ed           Zd	 ZeZ ed
           Zd ZeZdS )_GreenThreadzQWrapper for GreenThread objects to provide Thread-like attributes
    and methodsc                 F    || _         dt          z  | _        t          dz  ad S )NzGreenThread-%dr   )_g_count_name)selfgs     C/usr/local/lib/python3.11/dist-packages/eventlet/green/threading.py__init__z_GreenThread.__init__"   s"    %.
!    c                 (    d| j         d| j        dS )Nz<_GreenThread(z, z)>)r   r   r    s    r"   __repr__z_GreenThread.__repr__(   s     +/:::twww??r$   Nc                 4    | j                                         S N)r   wait)r    timeouts     r"   joinz_GreenThread.join+   s    w||~~r$   c                     | j         S r)   )r   r&   s    r"   getNamez_GreenThread.getName.   s
    zr$   c                 .    t          |          | _        d S r)   )strr   )r    names     r"   setNamez_GreenThread.setName2   s    YY


r$   c                 *    t          | j                  S r)   )idr   r&   s    r"   <lambda>z_GreenThread.<lambda>8   s    "TW++ r$   c                     dS NT r&   s    r"   isAlivez_GreenThread.isAlive:   s    tr$   c                     dS r7   r8   r&   s    r"   r5   z_GreenThread.<lambda>>   s    4 r$   c                     | j         S r)   )daemonr&   s    r"   isDaemonz_GreenThread.isDaemon@   s
    {r$   r)   )__name__
__module____qualname____doc__r#   r'   r,   r.   get_namer2   set_namepropertyr1   identr9   is_aliver<   r=   	is_daemonr8   r$   r"   r   r      s           @ @ @     H  H8GW%%DH--..E  HX''((F  IIIr$   r   c                     t           st          d          a t          t           j        d          rt          | d          s| j        | _        | S )Nr   rB   )__threading
__import__hasattrThreadr.   rB   )ts    r"   _fixup_threadrN   H   sN      . --"J// :&&Y
Hr$   c                     t          j                    } | s&t          t                                                    S 	 t
          j        n# t          $ r i xt
          _        Y nw xY wt          |           	                              }||S t          1t          j                            t          d          j                  a
fdt                      D             }|r|d         S fd}	 |                     |           t#          |           x}<   n6# t          $ r) t          t                                                    }Y nw xY w|S )Nr   c                 *    g | ]}|j         k    |S r8   )rE   ).0thg_ids     r"   
<listcomp>z"current_thread.<locals>.<listcomp>q   s%    DDDB28t3C3CR3C3C3Cr$   r   c                     = d S r)   r8   )r!   activerS   s    r"   cleanupzcurrent_thread.<locals>.cleanupv   s    4LLLr$   )greenlet
getcurrentrN   __orig_threadingr   __threadlocalrV   AttributeErrorr4   get__patched_enumerateeventletpatcherpatch_functionrJ   	enumeratelinkr   )r!   rM   foundrW   rV   rS   s       @@r"   r   r   Y   s   A @-<<>>???+% + + +(**%%%+ a55D

4A} "&.==j>U>U>_``DDDD-//DDDE Qx     +	w (??*F4LL  = = = *99;;<<	= Hs#   A A'&A'5D 0EE)rA   r_   eventlet.greenr   r   eventlet.supportr   rX   __patched__r`   originalrZ   r   r[   r^   injectglobalsr   r   rI   rN   r   r   r8   r$   r"   <module>rk      s3   C C  ! ! ! ! ! !       2 2 2 2 2 2$ $ $ _- -#,,[99  &&((  	   GIITN	   
$ $ $ $ $ $ $ $N   ") ) )X r$   