Current File : //usr/lib64/python3.6/site-packages/borg/__pycache__/locking.cpython-36.pyc |
3
y��b�9 � @ s� d dl Z d dlZd dlZd dlZddlmZ ddlmZmZ ddl m
Z
d\ZZd\Z
Ze
e�Z G d
d� d�ZG dd
� d
e�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� d�ZG dd� d�ZG dd� d�ZdS ) � N� )�platform)�Error�ErrorWithTraceback)�
create_logger�add�remove�shared� exclusivec @ sB e Zd ZdZddd�Zdd� Zdd� Zd d
� Zdd� Zd
d� Z dS )�TimeoutTimerz�
A timer for timeout checks (can also deal with "never timeout").
It can also compute and optionally execute a reasonable sleep time (e.g. to avoid
polling too often or to support thread/process rescheduling).
Nc C sX |dk r|dk rt d��|| _|dkrB|dkr4d}ntd|d �}|| _d| _d| _dS )ag
Initialize a timer.
:param timeout: time out interval [s] or None (never timeout, wait forever) [default]
:param sleep: sleep interval [s] (>= 0: do sleep call, <0: don't call sleep)
or None (autocompute: use 10% of timeout [but not more than 60s],
or 1s for "never timeout" mode)
Nr ztimeout must be >= 0g �?g N@g $@)�
ValueError�timeout_interval�min�sleep_interval�
start_time�end_time)�self�timeout�sleep� r �/usr/lib64/python3.6/locking.py�__init__ s zTimeoutTimer.__init__c C s d| j j| j| j| j| jf S )Nz)<%s: start=%r end=%r timeout=%r sleep=%r>)� __class__�__name__r r r
r )r r r r �__repr__+ s zTimeoutTimer.__repr__c C s&