← Back
Editing: _threadsafety.cpython-311.pyc
� d�c� � �\ � d dl Z d dlZg d�Z G d� de� � Z G d� d� � Zdd�ZdS ) � N)�ReentrancyError�ReentrancyLock� non_reentrantc � � e Zd ZdS )r N)�__name__� __module__�__qualname__� � �:/usr/lib/python3/dist-packages/scipy/_lib/_threadsafety.pyr r s � � � � � ��Dr r c �* � e Zd ZdZd� Zd� Zd� Zd� ZdS )r a Threading lock that raises an exception for reentrant calls. Calls from different threads are serialized, and nested calls from the same thread result to an error. The object can be used as a context manager or to decorate functions via the decorate() method. c �R � t j � � | _ d| _ || _ d S �NF)� threading�RLock�_rlock�_entered�_err_msg)�self�err_msgs r �__init__zReentrancyLock.__init__ s# � ��o�'�'����� ��� � � r c � � | j � � � | j r-| j � � � t | j � � �d| _ d S )NT)r �acquirer �releaser r )r s r � __enter__zReentrancyLock.__enter__ sO � ���������=� 1��K���!�!�!�!�$�-�0�0�0��� � � r c �F � d| _ | j � � � d S r )r r r )r �type�value� tracebacks r �__exit__zReentrancyLock.__exit__% s# � ��� ���������r c �X � � � fd�}t j j � ||� � S )Nc �L �� �5 | |i |��cd d d � � S # 1 swxY w Y d S �Nr )�func�a�kwr s �r �callerz'ReentrancyLock.decorate.<locals>.caller* s| �� �� &� &��t�Q�~�"�~�~� &� &� &� &� &� &� &� &� &� &� &� &���� &� &� &� &� &� &s ���)�scipy�_lib� decorator�decorate)r r$ r'