| Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/__pycache__/lock.cpython-311.pyc |
�
^Se� � �V � d dl mZ d dlZd dlZd dlZd� Zd� Zej d� � � ZdS )� )�absolute_importNc �0 � t j � | � � }|dk rPt j � |� � s1t j t j � | � � � � t | d� � }t
j |t j � � |� dd� � |�
� � |� t t j
� � � � � � |� � � |S )N� za+r )�os�path�dirname�exists�makedirs�open�fcntl�flock�LOCK_EX�seek�truncate�write�str�getpid�flush)�
lockfile_path�
lock_file_dir�fds ��/builddir/build/BUILDROOT/alt-python27-cllib-3.3.8-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/lock.py�
setup_lockr s� � ��G�O�O�M�2�2�M�����2�7�>�>�-�#@�#@��
��B�G�O�O�M�2�2�3�3�3�
�m�T� "� "�B�
�K��E�M�"�"�"��G�G�A�q�M�M�M��K�K�M�M�M��H�H�S�����
�
�����H�H�J�J�J�
�I� c � � t j | � � � t j � � | � � � d S )N)r r
�fileno�LOCK_UN�close)r s r �release_lockr s/ � � �K�� � ���U�]�+�+�+��H�H�J�J�J�J�Jr c # �N K � t | � � }dV � t |� � dS )zE
Usage:
with acquire_lock():
... do something ...
N)r r )r r s r �acquire_lockr! % s2 � � � �
�M� "� "�B� �E�E�E�������r ) �
__future__r �
contextlibr r r r �contextmanagerr! � r r �<module>r&