File: //opt/alt/python38/lib/python3.8/site-packages/lockfile/__pycache__/symlinklockfile.cpython-38.pyc
U
��UV8
� @ sL d dl mZ d dlZd dlZddlmZmZmZmZm Z G dd� de�Z
dS )� )�absolute_importN� )�LockBase� NotLocked� NotMyLock�LockTimeout�
AlreadyLockedc @ sD e Zd ZdZddd�Zddd�Zdd � Zd
d� Zdd
� Zdd� Z dS )�SymlinkLockFilez'Lock access to a file using symlink(2).TNc C s( t �| |||� tj�| j�d | _d S )Nr )r �__init__�os�path�split�unique_name)�selfr Zthreaded�timeout� r �I/opt/alt/python38/lib/python3.8/site-packages/lockfile/symlinklockfile.pyr
s zSymlinkLockFile.__init__c C s� |d k r|n| j }t�� }|d k r2|dkr2||7 }zt�| j| j� W nv tk
r� | �� rdY d S |d k r�t�� |kr�|dkr�td| j ��nt
d| j ��t�|d k r�|d nd� Y q2X d S q2d S )Nr z&Timeout waiting to acquire lock for %sz%s is already locked�
g�������?)r �timer �symlinkr � lock_file�OSError�i_am_lockingr r r �sleep)r r �end_timer r r �acquire s&