File: //usr/lib/python3/dist-packages/twisted/internet/__pycache__/kqreactor.cpython-38.pyc
U
��W[4( � @ s� d Z ddlmZmZ ddlZddlZddlmZmZ ddlmZm Z m
Z
ddlmZm
Z
mZmZ ddlmZmZ ddlmZmZ dd lmZmZ G d
d� de�Ze
�ee� eee�G dd
� d
ej��Zdd� Zd
dgZdS )am
A kqueue()/kevent() based implementation of the Twisted main loop.
To use this reactor, start your application specifying the kqueue reactor::
twistd --reactor kqueue ...
To install the event loop from code (and you should do this before any
connections, listeners or connectors are added)::
from twisted.internet import kqreactor
kqreactor.install()
� )�division�absolute_importN)�KQ_FILTER_READ�KQ_FILTER_WRITE)�KQ_EV_DELETE� KQ_EV_ADD� KQ_EV_EOF)�implementer�declarations� Interface� Attribute)�main� posixbase)�
IReactorFDSet�IReactorDaemonize)�log�failurec @ s e Zd ZdZed�Zed�ZdS )�_IKQueuez2
An interface for KQueue implementations.
zAn implementation of kqueue(2).zAn implementation of kevent(2).N)�__name__�
__module__�__qualname__�__doc__r �kqueue�kevent� r r �</usr/lib/python3/dist-packages/twisted/internet/kqreactor.pyr # s r c @ s� e Zd ZdZefdd�Zdd� Zdd� Zdd � Zd
d� Z dd
� Z
dd� Zdd� Zdd� Z
dd� Zdd� Zdd� Zdd� ZeZdS )�
KQueueReactoram
A reactor that uses kqueue(2)/kevent(2) and relies on Python 2.6 or higher
which has built in support for kqueue in the select module.
@ivar _kq: A C{kqueue} which will be used to check for I/O readiness.
@ivar _impl: The implementation of L{_IKQueue} to use.
@ivar _selectables: A dictionary mapping integer file descriptors to
instances of L{FileDescriptor} which have been registered with the
reactor. All L{FileDescriptor}s 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{_kq} for read readiness notifications
which will be dispatched to the corresponding L{FileDescriptor}
instances in C{_selectables}.
@ivar _writes: A set containing integer file descriptors. Values in this
set will be registered with C{_kq} for write readiness notifications
which will be dispatched to the corresponding L{FileDescriptor}
instances in C{_selectables}.
c C s8 || _ | j �� | _t� | _t� | _i | _tj� | � dS )a�
Initialize kqueue object, file descriptor tracking dictionaries, and
the base class.
See:
- http://docs.python.org/library/select.html
- www.freebsd.org/cgi/man.cgi?query=kqueue
- people.freebsd.org/~jlemon/papers/kqueue.pdf
@param _kqueueImpl: The implementation of L{_IKQueue} to use. A
hook for testing.
N)
�_implr �_kq�set�_reads�_writes�_selectablesr �PosixReactorBase�__init__)�selfZ_kqueueImplr r r r$ I s
zKQueueReactor.__init__c C s"