§
    0Fie*  ã                  óL   — d dl mZ d dlZd dlmZ d dlmZ  G d„ d¦  «        ZdS )é    )ÚannotationsN)ÚAsyncIterator)Úasynccontextmanagerc                  ó`   — e Zd ZU dZded<   ded<   ded<   d„ Zdd„Zdd„Zedd„¦   «         Z	dS )ÚRLocka  asyncio reentrant lock, which allows the same owner (or two owners that compare
    as equal) to be inside the critical section at the same time.

    Note that here the owner is an explicit, generic object, whereas in
    :func:`threading.RLock` and :func:`multiprocessing.RLock` it's hardcoded
    respectively to the thread ID and process ID.

    **Usage**::

        lock = RLock()
        async with lock("my-owner"):
            ...

    **Tip**

    You can mix reentrant and non-reentrant owners; all you need to do is create an
    owner that doesn't compare as equal to other instances of itself::

        lock = RLock()

        async def non_reentrant():
            async with lock(object()):
                ...

        async def reentrant():
            async with lock("foo"):
                ...

    In the above example, at any time you may have inside the critical section
    at most one call to ``non_reentrant`` and no calls to ``reentrant``, or any number
    of calls to ``reentrant`` but no calls to ``non_reentrant``.
    ÚobjectÚ_ownerÚintÚ_countzasyncio.LockÚ_lockc                óR   — d | _         d| _        t          j        ¦   «         | _        d S )Nr   )r	   r   ÚasyncioÚLockr   )Úselfs    ú4lib/python3.11/site-packages/distributed/_asyncio.pyÚ__init__zRLock.__init__.   s!   € ØˆŒØˆŒÝ”\‘^”^ˆŒ
ˆ
ˆ
ó    ÚownerÚreturnÚNonec              ƒ  ó¢   K  — | j         dk    s| j        |k    r&| j                             ¦   «         ƒ d {V —† || _        | xj         dz  c_         d S )Nr   é   )r   r	   r   Úacquire©r   r   s     r   r   zRLock.acquire3   s`   è è € ØŒ;˜!ÒÐ˜tœ{¨eÒ3Ð3Ø”*×$Ò$Ñ&Ô&Ð&Ð&Ð&Ð&Ð&Ð&Ð&ØˆDŒKØˆŒqÑˆŒˆˆr   c                óÊ   — | j         dk    s| j        |k    rt          d¦  «        ‚| xj         dz  c_         | j         dk    r"d | _        | j                             ¦   «          d S d S )Nr   z)release unlocked lock or mismatched ownerr   )r   r	   ÚRuntimeErrorr   Úreleaser   s     r   r   zRLock.release9   sp   € ØŒ;˜!ÒÐ˜tœ{¨eÒ3Ð3ÝÐJÑKÔKÐKØˆŒqÑˆŒØŒ;˜!ÒÐØˆDŒKØŒJ×ÒÑ Ô Ð Ð Ð ð Ðr   úAsyncIterator[None]c               óª   K  — |                       |¦  «        ƒ d {V —† 	 d W V — |                      |¦  «         d S # |                      |¦  «         w xY w)N)r   r   r   s     r   Ú__call__zRLock.__call__A   sj   è è € àlŠl˜5Ñ!Ô!Ð!Ð!Ð!Ð!Ð!Ð!Ð!ð	 ØˆEˆEˆEˆEàLŠL˜ÑÔÐÐÐøˆDLŠL˜ÑÔÐÐøøøs	   Ÿ; »AN)r   r   r   r   )r   r   r   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   r   r   r   r    © r   r   r   r      s™   € € € € € € ðð ðB €N€NNØ€K€KKØÐÐÑð$ð $ð $ð
ð ð ð ð!ð !ð !ð !ð ð ð  ð  ñ Ôð ð  ð  r   r   )Ú
__future__r   r   Úcollections.abcr   Ú
contextlibr   r   r&   r   r   ú<module>r*      sv   ðØ "Ð "Ð "Ð "Ð "Ð "à €€€Ø )Ð )Ð )Ð )Ð )Ð )Ø *Ð *Ð *Ð *Ð *Ð *ð? ð ? ð ? ð ? ð ? ñ ? ô ? ð ? ð ? ð ? r   