|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /opt/alt/python37/lib/python3.7/site-packages/beaker/__pycache__/ |
Upload File : |
B
��[- � @ s0 d Z ddlZddlZddlZddlZyddlZW n ek
rL ddlZY nX ye� � dZ
W n6 yddlZdZ
W n ek
r� dZ
Y nX Y nX ddlm
Z
ddlmZ ddd d
dgZG dd
� d
e�Ze
�� Zd
d� Zdd� Zdd� ZG dd � d e�ZG dd� de�ZG dd� de�ZG dd� de�ZdS )z�Synchronization functions.
File- and mutex-based mutual exclusion synchronizers are provided,
as well as a name-based mutex which locks within an application
based on a string name.
� NFT)�util)� LockError�file_synchronizer�mutex_synchronizer�null_synchronizer�NameLock�
_threadingc @ sD e Zd ZdZe�� ZG dd� de�Zd
dd�Z dd d
�Z
dd� ZdS )r z�a proxy for an RLock object that is stored in a name based
registry.
Multiple threads can get a reference to the same RLock based on the
name alone, and synchronize operations related to that name.
c @ s e Zd Zdd� Zdd� ZdS )zNameLock.NLContainerc C s |rt �� | _n
t �� | _d S )N)r �RLock�lock�Lock)�self� reentrant� r �G/opt/alt/python37/lib/python3.7/site-packages/beaker/synchronization.py�__init__/ s zNameLock.NLContainer.__init__c C s | j S )N)r
)r r r r �__call__5 s zNameLock.NLContainer.__call__N)�__name__�
__module__�__qualname__r r r r r r �NLContainer. s r NFc C s. |d krt �|�| _nt j�|t j|�| _d S )N)r r �_lock�locks�get)r �
identifierr
r r r r 8 s zNameLock.__init__Tc C s | � � �|�S )N)r �acquire)r �waitr r r r ? s zNameLock.acquirec C s | � � �� d S )N)r �release)r r r r r B s zNameLock.release)NF)T)r r r �__doc__r �WeakValuedRegistryr �objectr r r r r r r r r $ s
c K s t j| |f|| f|�S )N)�_synchronizersZsync_get)r �cls�kwargsr r r �
_synchronizerI s r# c K s&