(self, *, loop, fd)
Register a file descriptor with the CFRunLoop, or modify its state
        so that it's listening for both notifications (read and write) rather
        than just one; used to implement add_reader and add_writer.
Register a file descriptor with the CFRunLoop, or modify its state
        so that it's listening for both notifications (read and write) rather
        than just one; used to implement add_reader and add_writer.
Register a file descriptor with the CFRunLoop or modify its state so that it s listening for both notifications ( read and write ) rather than just one ; used to implement add_reader and add_writer .
def __init__(self, *, loop, fd):
        """
        Register a file descriptor with the CFRunLoop, or modify its state
        so that it's listening for both notifications (read and write) rather
        than just one; used to implement add_reader and add_writer.
        """
        super().__init__(CFSocketCallback(self._cf_socket_callback), None, loop)

        # Retain a reference to the Handle
        self._loop._sockets[fd] = self
        self._reader = None
        self._writer = None

        self._fd = fd
        self._cf_socket = libcf.CFSocketCreateWithNative(
            kCFAllocatorDefault, self._fd,
            kCFSocketReadCallBack | kCFSocketWriteCallBack
            | kCFSocketConnectCallBack,
            self._callback,
            None
        )
        libcf.CFSocketSetSocketFlags(
            self._cf_socket,
            kCFSocketAutomaticallyReenableReadCallBack
            | kCFSocketAutomaticallyReenableWriteCallBack

            # # This extra flag is to ensure that CF doesn't (destructively,
            # # because destructively is the only way to do it) retrieve
            # # SO_ERROR
            # 1 << 6
        )
        self._src = libcf.CFSocketCreateRunLoopSource(kCFAllocatorDefault, self._cf_socket, 0)
        libcf.CFRunLoopAddSource(self._loop._cfrunloop, self._src, kCFRunLoopCommonModes)
        libcf.CFSocketDisableCallBacks(
            self._cf_socket,
            kCFSocketReadCallBack | kCFSocketWriteCallBack
            | kCFSocketConnectCallBack
        )
def __init__ ( self , * , loop , fd ) : super ( ) . __init__ ( CFSocketCallback ( self . _cf_socket_callback ) , None , loop ) # Retain a reference to the Handle self . _loop . _sockets [ fd ] = self self . _reader = None self . _writer = None self . _fd = fd self . _cf_socket = libcf . CFSocketCreateWithNative ( kCFAllocatorDefault , self . _fd , kCFSocketReadCallBack | kCFSocketWriteCallBack | kCFSocketConnectCallBack , self . _callback , None ) libcf . CFSocketSetSocketFlags ( self . _cf_socket , kCFSocketAutomaticallyReenableReadCallBack | kCFSocketAutomaticallyReenableWriteCallBack # # This extra flag is to ensure that CF doesn't (destructively, # # because destructively is the only way to do it) retrieve # # SO_ERROR # 1 << 6 ) self . _src = libcf . CFSocketCreateRunLoopSource ( kCFAllocatorDefault , self . _cf_socket , 0 ) libcf . CFRunLoopAddSource ( self . _loop . _cfrunloop , self . _src , kCFRunLoopCommonModes ) libcf . CFSocketDisableCallBacks ( self . _cf_socket , kCFSocketReadCallBack | kCFSocketWriteCallBack | kCFSocketConnectCallBack )