%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/internet/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/internet/__pycache__/epollreactor.cpython-312.pyc

�

Ϫ�f�"��2�dZddlZddlZddlmZddlmZddlmZddl	m
Z
	eed�Zeed�Z
eed	�Zeed
�Zeed�Zee�Gd�d
ej(ej*��Zd�Zd
dgZy#e$r
Zee��dZ[wwxYw)z�
An epoll() based implementation of the twisted main loop.

To install the event loop (and you should do this before any connections,
listeners or connectors are added)::

    from twisted.internet import epollreactor
    epollreactor.install()
�N)�implementer)�	posixbase)�
IReactorFDSet)�log�epoll�EPOLLHUP�EPOLLERR�EPOLLIN�EPOLLOUTc�h�eZdZdZeezZeZe	Z
d�Zd�Zd�Z
d�Zd�Zd�Zd�Zd	�Zd
�Zd�Zd�ZeZy
)�EPollReactora�
    A reactor that uses epoll(7).

    @ivar _poller: A C{epoll} which will be used to check for I/O
        readiness.

    @ivar _selectables: A dictionary mapping integer file descriptors to
        instances of C{FileDescriptor} which have been registered with the
        reactor.  All C{FileDescriptors} which are currently receiving read or
        write readiness notifications will be present as values in this
        dictionary.

    @ivar _reads: A set containing integer file descriptors.  Values in this
        set will be registered with C{_poller} for read readiness notifications
        which will be dispatched to the corresponding C{FileDescriptor}
        instances in C{_selectables}.

    @ivar _writes: A set containing integer file descriptors.  Values in this
        set will be registered with C{_poller} for write readiness
        notifications which will be dispatched to the corresponding
        C{FileDescriptor} instances in C{_selectables}.

    @ivar _continuousPolling: A L{_ContinuousPolling} instance, used to handle
        file descriptors (e.g. filesystem files) that are not supported by
        C{epoll(7)}.
    c���td�|_t�|_t�|_i|_t
j|�|_tjj|�y)zm
        Initialize epoll object, file descriptor tracking dictionaries, and the
        base class.
        iN)r�_poller�set�_reads�_writes�_selectablesr�_ContinuousPolling�_continuousPolling�PosixReactorBase�__init__)�selfs �?/usr/lib/python3/dist-packages/twisted/internet/epollreactor.pyrzEPollReactor.__init__GsP���T�{����e����u������"+�">�">�t�"D����"�"�+�+�D�1�c���|j�}||vr[|}||vr"||z}|jj||�n|jj||�|j	|�|||<yy)z�
        Private method for adding a descriptor from the event loop.

        It takes care of adding it if  new or modifying it if already added
        for another state (read -> read/write for example).
        N)�filenor�modify�register�add)	r�xer�primary�other�selectables�event�	antievent�fd�flagss	         r�_addzEPollReactor._addVsr���Z�Z�\��
�W���E��U�{���"�����#�#�B��.����%�%�b�%�0�
�K�K��O�!�K��O�!rc��	|j||j|j|jtt
�y#t$rD}|jtjk(r|jj|�n�Yd}~yd}~wwxYw)zR
        Add a FileDescriptor for notification of data available to read.
        N)r(rrrr
r�OSError�errno�EPERMr�	addReader)r�reader�es   rr-zEPollReactor.addReaderpsn��	��I�I�����T�\�\�4�3D�3D�g�x�
���	��w�w�%�+�+�%��'�'�1�1�&�9��:��	���<?�	B�:B�Bc��	|j||j|j|jtt
�y#t$rD}|jtjk(r|jj|�n�Yd}~yd}~wwxYw)zS
        Add a FileDescriptor for notification of data available to write.
        N)r(rrrrr
r*r+r,r�	addWriter)r�writerr/s   rr2zEPollReactor.addWriter�so��	��I�I�����d�k�k�4�3D�3D�h�PW�
���	��w�w�%�+�+�%��'�'�1�1�&�9��:��	�r0c��|j�}|dk(r|j�D]\}}||us�ny||vrS||vr|}	|jj||	�n||=|jj	|�|j|�yy)z�
        Private method for removing a descriptor from the event loop.

        It does the inverse job of _add, and also add a check in case of the fd
        has gone away.
        ���N)r�itemsrr�
unregister�remove)
rr r!r"r#r$r%r&�fdesr's
          r�_removezEPollReactor._remove�s����Z�Z�\��
��8�'�-�-�/�
���D��$�;��
��
��=��U�{�!�����#�#�B��.���O����'�'��+��N�N�2��rc���|jj|�r|jj|�y|j||j|j
|jtt�y)zQ
        Remove a Selectable for notification of data available to read.
        N)	r�	isReading�removeReaderr:rrrr
r)rr.s  rr=zEPollReactor.removeReader�sV���"�"�,�,�V�4��#�#�0�0��8������D�K�K����t�/@�/@�'�8�	
rc���|jj|�r|jj|�y|j||j|j
|jtt�y)zR
        Remove a Selectable for notification of data available to write.
        N)	r�	isWriting�removeWriterr:rrrrr
)rr3s  rr@zEPollReactor.removeWriter�sV���"�"�,�,�V�4��#�#�0�0��8������D�L�L�$�+�+�t�/@�/@�(�G�	
rc��|j|jD�cgc]}|j|��c}|jD�cgc]}|j|��c}�|jj�zScc}wcc}w)zD
        Remove all selectables, and return a list of them.
        )�
_removeAllrrrr�	removeAll�rr&s  rrCzEPollReactor.removeAll�sn��

�O�O�15���=�2��"�"�2�&�=�15���>�2��"�"�2�&�>�
��%�%�/�/�1�	
2�	
��=��>s�A8�A=
c��|jD�cgc]}|j|��c}|jj�zScc}w�N)rrr�
getReadersrDs  rrGzEPollReactor.getReaders�sE��,0�K�K�
�&(�D���b�!�
��#�#�.�.�0�1�	1��
��Ac��|jD�cgc]}|j|��c}|jj�zScc}wrF)rrr�
getWritersrDs  rrJzEPollReactor.getWriters�sE��,0�L�L�
�&(�D���b�!�
��#�#�.�.�0�1�	1��
rHc�p�|�d}	|jj|t|j��}|j}|D].\}}	|j|}tj|||||��0y#t$r(}|j
t
jk(rYd}~y�d}~wwxYw#t$rY�qwxYw)z1
        Poll the poller for new events.
        Nr5)r�poll�lenrr*r+�EINTR�_doReadOrWriter�callWithLogger�KeyError)r�timeout�l�err�_drdwr&r$�
selectables        r�doPollzEPollReactor.doPoll�s����?��G�
	�
���!�!�'�3�t�/@�/@�+A�B�A��#�#���	M�I�B��
M�!�.�.�r�2�
��"�"�:�u�j�"�e�L�
	M���	��y�y�E�K�K�'��

��	���
��
�s/�/A5�
B)�5	B&�>B!� B!�!B&�)	B5�4B5N)�__name__�
__module__�__qualname__�__doc__rr	�_POLL_DISCONNECTEDr
�_POLL_INr�	_POLL_OUTrr(r-r2r:r=r@rCrGrJrW�doIteration�rrr
r
%s]���8"�H�,���H��I�
2�"�4�"�"�2	
�	
�

�1�
1�
M�>�Krr
c�4�t�}ddlm}||�y)z&
    Install the epoll() reactor.
    r)�installReactorN)r
�twisted.internet.mainrb)�prbs  r�installre�s��	��A�4��1�rre)r[r+�select�zope.interfacer�twisted.internetr�twisted.internet.interfacesr�twisted.pythonr�getattrrrr	r
r�AttributeErrorr/�ImportErrorr�_PollLikeMixinr
re�__all__r`rr�<module>rps����
�
�&�&�5���

�F�G�$�E��v�z�*�H��v�z�*�H��f�i�(�G��v�z�*�H�

�]��P�9�-�-�y�/G�/G�P��P�f��9�
%���E��
�a�.����s�-B�B�	B�B

Zerion Mini Shell 1.0