Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python35
/
lib
/
python3.5
/
site-packages
/
fasteners
/
__pycache__
/
File Content:
process_lock.cpython-35.pyc
V�EV�! � @ s� d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z e j e � Z d d � Z Gd d � d e � Z Gd d � d e � Z Gd d � d e � Z e j d k r� d d l Z e Z n d d l Z e Z d d � Z d S)� N)�_utilsc C s� y t j | � Wno t k r� } zO | j t j k rW t j j | � sP � qp d Sn | j t j k rm d S� WYd d } ~ Xn Xd Sd S)zfCreate a directory (and any ancestor directories required). :param path: Directory to create FNT)�os�makedirs�OSError�errno�EEXIST�path�isdirZEISDIR)r �e� r �/process_lock.py�_ensure_tree s r c @ s� e Z d Z d Z d Z d Z e j d d d � Z d d � Z d d � Z d e e d d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d S)�_InterProcessLockaT An interprocess locking implementation. This is a lock implementation which allows multiple locks, working around issues like http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632857 and does not require any cleanup. Since the lock is always held on a file descriptor rather than outside of the process, the lock gets dropped automatically if the process crashes, even if ``__exit__`` is not executed. There are no guarantees regarding usage by multiple threads in a single process here. This lock works only between processes. Note these locks are released when the descriptor is closed, so it's not safe to close the file descriptor while another thread holds the lock. Just opening and closing the lock file can break synchronization, so lock files must be accessed only using this abstraction. g�������?g{�G�z�?Nc C s= d | _ | | _ d | _ | | _ t j | t � | _ d S)NF)�lockfiler �acquired� sleep_funcr Zpick_first_not_none�LOG�logger)�selfr r r r r r �__init__U s z_InterProcessLock.__init__c C s� y | j � Wn� t k r� } zh | j t j t j f k rd | sQ | j � rU d St j � � n"