Ë
    V.j!  ã                   ó8   — d dl Z dZ G d„ d«      Z G d„ d«      Zy)é    NzMateusz Kobosc                   ó.   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚRWLocka  
    Read-Write locking primitive

    Synchronization object used in a solution of so-called second
    readers-writers problem. In this problem, many readers can simultaneously
    access a share, and a writer has an exclusive access to this share.
    Additionally, the following constraints should be met:
    1) no reader should be kept waiting if the share is currently opened for
       reading unless a writer is also waiting for the share,
    2) no writer should be kept waiting for the share longer than absolutely
       necessary.

    The implementation is based on [1, secs. 4.2.2, 4.2.6, 4.2.7]
    with a modification -- adding an additional lock (C{self.__readers_queue})
    -- in accordance with [2].

    Sources:
    [1] A.B. Downey: "The little book of semaphores", Version 2.1.5, 2008
    [2] P.J. Courtois, F. Heymans, D.L. Parnas:
        "Concurrent Control with 'Readers' and 'Writers'",
        Communications of the ACM, 1971 (via [3])
    [3] http://en.wikipedia.org/wiki/Readers-writers_problem
    c                 óÖ   — t        «       | _        t        «       | _        t        j                  «       | _        t        j                  «       | _        t        j                  «       | _        y)zz
        A lock giving an even higher priority to the writer in certain
        cases (see [2] for a discussion).
        N)Ú_LightSwitchÚ_RWLock__read_switchÚ_RWLock__write_switchÚ	threadingÚLockÚ_RWLock__no_readersÚ_RWLock__no_writersÚ_RWLock__readers_queue©Úselfs    úOC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\ecdsa/_rwlock.pyÚ__init__zRWLock.__init__$   sE   € ô
 *›^ˆÔÜ*›nˆÔÜ%ŸN™NÓ,ˆÔÜ%ŸN™NÓ,ˆÔÜ(Ÿ~™~Ó/ˆÕó    c                 ó  — | j                   j                  «        | j                  j                  «        | j                  j                  | j                  «       | j                  j                  «        | j                   j                  «        y ©N)r   Úacquirer   r   r   Úreleaser   s    r   Úreader_acquirezRWLock.reader_acquire/   sd   € Ø×Ñ×$Ñ$Ô&Ø×Ñ×!Ñ!Ô#Ø×Ñ×"Ñ" 4×#4Ñ#4Ô5Ø×Ñ×!Ñ!Ô#Ø×Ñ×$Ñ$Õ&r   c                 óN   — | j                   j                  | j                  «       y r   )r   r   r   r   s    r   Úreader_releasezRWLock.reader_release6   s   € Ø×Ñ×"Ñ" 4×#4Ñ#4Õ5r   c                 ó‚   — | j                   j                  | j                  «       | j                  j                  «        y r   )r   r   r   r   r   s    r   Úwriter_acquirezRWLock.writer_acquire9   s.   € Ø×Ñ×#Ñ# D×$5Ñ$5Ô6Ø×Ñ×!Ñ!Õ#r   c                 ó‚   — | j                   j                  «        | j                  j                  | j                  «       y r   )r   r   r   r   r   s    r   Úwriter_releasezRWLock.writer_release=   s.   € Ø×Ñ×!Ñ!Ô#Ø×Ñ×#Ñ# D×$5Ñ$5Õ6r   N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   © r   r   r   r      s    „ ñò0	0ò'ò6ò$ó7r   r   c                   ó"   — e Zd ZdZd„ Zd„ Zd„ Zy)r   z‘An auxiliary "light switch"-like object. The first thread turns on the
    "switch", the last one turns it off (see [1, sec. 4.2.2] for details).c                 óD   — d| _         t        j                  «       | _        y )Nr   )Ú_LightSwitch__counterr	   r
   Ú_LightSwitch__mutexr   s    r   r   z_LightSwitch.__init__F   s   € ØˆŒÜ —~‘~Ó'ˆ�r   c                 óÔ   — | j                   j                  «        | xj                  dz  c_        | j                  dk(  r|j                  «        | j                   j                  «        y )Né   ©r&   r   r%   r   ©r   Úlocks     r   r   z_LightSwitch.acquireJ   óE   € Ø�‰×ÑÔØ�Š˜!Ñ�Ø�>‰>˜QÒØ�L‰LŒNØ�‰×ÑÕr   c                 óÔ   — | j                   j                  «        | xj                  dz  c_        | j                  dk(  r|j                  «        | j                   j                  «        y )Nr(   r   r)   r*   s     r   r   z_LightSwitch.releaseQ   r,   r   N)r   r   r    r!   r   r   r   r"   r   r   r   r   B   s   „ ñNò(òór   r   )r	   Ú
__author__r   r   r"   r   r   Ú<module>r/      s&   ðó
 ð €
÷47ñ 47÷nò r   