o
    $i                     @   s2   d dl mZ d dlmZ ededefddZdS )    )Callable)OldAPIStackfuncreturnc                    s    fdd}|S )a  Use as decorator (@withlock) around object methods that need locking.

    Note: The object must have a self._lock = threading.Lock() property.
    Locking thus works on the object level (no two locked methods of the same
    object can be called asynchronously).

    Args:
        func: The function to decorate/wrap.

    Returns:
        The wrapped (object-level locked) function.
    c              
      s~   z"| j   | g|R i |W  d    W S 1 sw   Y  W d S  ty> } zd|jd v r8td| |d }~ww )Nzhas no attribute '_lock'r   zhObject {} must have a `self._lock` property (assigned to a threading.RLock() object in its constructor)!)_lockAttributeErrorargsformat)selfaker    V/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/ray/rllib/utils/threading.pywrapper   s   (zwith_lock.<locals>.wrapperr   )r   r   r   r   r   	with_lock   s   r   N)typingr   ray.rllib.utils.annotationsr   r   r   r   r   r   <module>   s    