
    h                         S r SSKJr   " S S5      rS rS\l        S rS rS	 rS
 r	SS jr
\" 5       rS rS rS rSqSqSqSq SSKr\r\
" S5        / SQrg! \ a    Sr Nf = f)zT
A module to provide some very basic threading primitives, such as
synchronization.
    wrapsc                       \ rS rSrSrS rSrg)	DummyLock   z>
Hack to allow locks to be unpickled on an unthreaded system.
c                     [         S4$ N unpickle_lockselfs    `/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/python/threadable.py
__reduce__DummyLock.__reduce__   s    r""    r
   N)__name__
__module____qualname____firstlineno____doc__r   __static_attributes__r
   r   r   r   r      s    #r   r   c                  8    [         b
  [        5       $ [        5       $ N)threadingmoduleXLockr   r
   r   r   r   r      s    "w{r   Tc                     SU R                   ;  aO  [        R                  5         SU R                   ;  a  [        5       U R                   S'   [        R	                  5         U R
                  R                  5         g )N_threadable_lock)__dict___synchLockCreatoracquirer   releaser   r   s    r   	_synchPrer#   !   sU    .!!#T]]205DMM,-!!#!!#r   c                 8    U R                   R                  5         g r   )r   r"   r   s    r   
_synchPostr%   *   s    !!#r   c                 0   ^ [        T5      U4S j5       nU$ )Nc                 j   > [        U 5         T" U /UQ70 UD6[        U 5        $ ! [        U 5        f = fr   )r#   r%   )r   argskwargsfunctions      r   sync_sync.<locals>.sync/   s2    $	D24262tJts   % 2r   )klassr*   r+   s    ` r   _syncr.   .   s     
8_  Kr   c                      [         bA  U  H:  nUR                   H'  n[        XR                  U   5      n[	        XU5        M)     M<     gg)a  
Make all methods listed in each class' synchronized attribute synchronized.

The synchronized attribute should be a list of strings, consisting of the
names of methods that must be synchronized. If we are running in threaded
mode these methods will be wrapped with a lock.
N)r   synchronizedr.   r   setattr)klassesr-   
methodNamer+   s       r   synchronizer4   :   sF     "E#00
UNN:$>?40 1  #r   c                     U (       aD  [         (       d8  [        b&  Sq  " S S[        R                  5      q[        5       qg[        S5      eg[         (       a  [        S5      eg)zZInitialize threading.

Don't bother calling this.  If it needs to happen, it will happen.
NTc                       \ rS rSrS rSrg)r   U   c                     [         S4$ r	   r   r   s    r   r   XLock.__reduce__V   s     -r22r   r
   N)r   r   r   r   r   r   r
   r   r   r   r   U   s    3r   r   z:Cannot initialize threading, platform lacks thread supportzCannot uninitialize threads)threadedr   _RLockr   r    RuntimeError)with_threadss    r   initr>   I   s^     x*3O22 3 %*G!"P   8<==r   c                  X    [         c  [        $ [         R                  5       R                  $ r   )r   _dummyIDcurrent_threadidentr
   r   r   getThreadIDrC   h   s"    ))+111r   c                  $    [         [        5       :H  $ )zCAre we in the thread responsible for I/O requests (the event loop)?)ioThreadrC   r
   r   r   isInIOThreadrF   n   s    {}$$r   c                      [        5       qg)z8Mark the current thread as responsible for I/O requests.N)rC   rE   r
   r   r   registerAsIOThreadrH   s   s     }Hr   NF)rF   rH   rC   r   )   )r   	functoolsr   r   r   __safe_for_unpickling__r#   r%   r.   r4   r>   objectr@   rC   rF   rH   rE   r:   r    r   	threading_threadingmoduler   ImportError__all__r
   r   r   <module>rQ      s   
 # # )- %$$	18 82%
  ( 'OJ I  Os   A A%$A%