HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/twisted/python/__pycache__/threadable.cpython-38.pyc
U

�b��@s�dZddlmZGdd�d�Zdd�Zde_dd	�Zd
d�Zdd
�Zdd�Z	ddd�Z
e�Zdd�Z
dd�Zdd�ZdadadadazddlZWnek
r�dZYnXeZe
d�ddddgZdS)zT
A module to provide some very basic threading primitives, such as
synchronization.
���wrapsc@seZdZdZdd�ZdS)�	DummyLockzF
    Hack to allow locks to be unpickled on an unthreaded system.
    cCstdfS�N���
unpickle_lock��selfrr�;/usr/lib/python3/dist-packages/twisted/python/threadable.py�
__reduce__szDummyLock.__reduce__N)�__name__�
__module__�__qualname__�__doc__rrrrrrsrcCstdk	rt�St�SdS�N)�threadingmodule�XLockrrrrrrsrTcCs>d|jkr0t��d|jkr(t�|jd<t��|j��dS)N�_threadable_lock)�__dict__�_synchLockCreator�acquirer�releaserr	rrr�	_synchPre!s

rcCs|j��dSr)rrr	rrr�
_synchPost*srcst���fdd��}|S)Ncs,t|�z�|f|�|�W�St|�XdSr)rr)r
�args�kwargs��functionrr�sync/sz_sync.<locals>.syncr)�klassrrrrr�_sync.sr!cGs>tdk	r:|D],}|jD] }t||j|�}t|||�qqdS)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)Zklassesr �
methodNamerrrr�synchronize:s

r%�cCsJ|r8tsFtdk	r.daGdd�dtj�at�aqFtd��ntrFtd��ndS)zbInitialize threading.

    Don't bother calling this.  If it needs to happen, it will happen.
    NTc@seZdZdd�ZdS)rcSstdfSrrr	rrrrVszXLock.__reduce__N)r
rrrrrrrrUsrz:Cannot initialize threading, platform lacks thread supportzCannot uninitialize threads)�threadedr�_RLockrr�RuntimeError)Zwith_threadsrrr�initIs�
r*cCstdkrtSt��jSr)r�_dummyID�current_thread�identrrrr�getThreadIDhsr.cCs
tt�kS)zCAre we in the thread responsible for I/O requests (the event loop)?)�ioThreadr.rrrr�isInIOThreadnsr0cCs
t�adS)z8Mark the current thread as responsible for I/O requests.N)r.r/rrrr�registerAsIOThreadssr1NFr)r&)r�	functoolsrrr�__safe_for_unpickling__rrr!r%r*�objectr+r.r0r1r/r'rr�	threadingZ_threadingmodule�ImportErrorr�__all__rrrr�<module>s0