File: //usr/lib/python3/dist-packages/filelock/__pycache__/_windows.cpython-310.pyc
o
;�bb � @ s� d dl mZ d dlZd dlZd dlmZ d dlmZ ddlm Z ddl
mZ ejdkr8d dl
Z
G d d
� d
e �ZnG dd
� d
e �Zd
gZdS )� )�annotationsN)�ENOENT)�cast� )�BaseFileLock)�raise_on_exist_ro_file�win32c @ �$ e Zd ZdZd dd�Zd dd�ZdS )
�WindowsFileLock�WUses the :func:`msvcrt.locking` function to hard lock the lock file on windows systems.�return�Nonec
C s� t | j� tjtjB tjB }z t�| j|�}W n ty0 } z
|jt kr%� W Y d }~d S d }~ww z
t
�|t
jd� W n tyJ t�
|� Y d S w || _d S �Nr )r �
_lock_file�os�O_RDWR�O_CREAT�O_TRUNC�open�OSError�errnor �msvcrt�locking�LK_NBLCK�close�
_lock_file_fd)�self�mode�fd� exception� r �3/usr/lib/python3/dist-packages/filelock/_windows.py�_acquire s*
���
����
�WindowsFileLock._acquirec C sT t t| j�}d | _t�|tjd� t�|� z t�| j � W d S t
y) Y d S w r )r �intr r r �LK_UNLCKr r �remover r )r r r r r! �_release% s
��WindowsFileLock._releaseN�r r
��__name__�
__module__�__qualname__�__doc__r"