← back to Atmos Game
assets/gen/.venv/lib/python3.12/site-packages/filelock/_soft_rw/__pycache__/_async.cpython-312.pyc
109 lines
�
c�bj$ � �� � d Z ddlmZ ddlZddlZddlZddlmZ ddlm Z m
Z
mZ ddlm
Z
e rddlmZmZ dd lmZ dd
lmZ e
d� Z ed� Z G d
� d� Z G d� d� ZddgZy)zIAsync wrapper around :class:`SoftReadWriteLock` for use with ``asyncio``.� )�annotationsN)�asynccontextmanager)�
TYPE_CHECKING� ParamSpec�TypeVar� )�SoftReadWriteLock)�AsyncGenerator�Callable)�futures)�
TracebackType�_P�_Rc �@ � e Zd ZdZ ddddddddd� dd�Zedd�� Zedd �� Zedd
�� Zedd�� Z edd�� Z
eddd
�d d�� Zeddd
�d d�� Z
ddd
� d!d�Z ddd
� d!d�Zdd�d"d�Zd#d�Zd#d�Zd$d�Zy)%�AsyncSoftReadWriteLocka�
Async wrapper around :class:`SoftReadWriteLock` for ``asyncio`` applications.
The sync class's blocking filesystem operations run on a thread pool via ``loop.run_in_executor()``. The
underlying :class:`SoftReadWriteLock` handles reentrancy, upgrade/downgrade rules, fork handling, heartbeat and
TTL stale detection, and singleton behavior.
:param lock_file: path to the lock file; sidecar state/write/readers live next to it
:param timeout: maximum wait time in seconds; ``-1`` means block indefinitely
:param blocking: if ``False``, raise :class:`~filelock.Timeout` immediately on contention
:param is_singleton: if ``True``, reuse existing :class:`SoftReadWriteLock` instances per resolved path
:param heartbeat_interval: seconds between heartbeat refreshes; default 30 s
:param stale_threshold: seconds of mtime inactivity before a marker is stale; defaults to ``3 * heartbeat_interval``
:param poll_interval: seconds between acquire retries under contention; default 0.25 s
:param loop: event loop for ``run_in_executor``; ``None`` uses the running loop
:param executor: executor for ``run_in_executor``; ``None`` uses the default executor
.. versionadded:: 3.27.0
Tg >@Ng �?)�blocking�is_singleton�heartbeat_interval�stale_threshold�
poll_interval�loop�executorc � � t j � | _ t |||||||�� | _ || _ | | _ y )N)r r r r r )�os�getpid�_creator_pidr �_lock�_loop� _executor)
�self� lock_file�timeoutr r r r r r r s
�o/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/filelock/_soft_rw/_async.py�__init__zAsyncSoftReadWriteLock.__init__, sC � � �I�I�K���&����%�1�+�'�
��
� ��
�!��� c �. � | j j S )z4The path to the lock file passed to the constructor.)r r! �r s r# r! z AsyncSoftReadWriteLock.lock_fileF s � � �z�z�#�#�#r% c �. � | j j S )z\The default timeout applied when ``acquire_read`` / ``acquire_write`` is called without one.)r r"