def _init_events_pipe(self):
    'Create a self-pipe for the native thread to synchronize on.\n\n        This code is taken from the eventlet tpool module, under terms\n        of the Apache License v2.0.\n        '
    self._event_queue = native_Queue.Queue()
    try:
        (rpipe, wpipe) = os.pipe()
        self._event_notify_send = greenio.GreenPipe(wpipe, 'wb', 0)
        self._event_notify_recv = greenio.GreenPipe(rpipe, 'rb', 0)
    except (ImportError, NotImplementedError):
        sock = eventlet_util.__original_socket__(socket.AF_INET, socket.SOCK_STREAM)
        sock.bind(('localhost', 0))
        sock.listen(50)
        csock = eventlet_util.__original_socket__(socket.AF_INET, socket.SOCK_STREAM)
        csock.connect(('localhost', sock.getsockname()[1]))
        (nsock, addr) = sock.accept()
        self._event_notify_send = nsock.makefile('wb', 0)
        gsock = greenio.GreenSocket(csock)
        self._event_notify_recv = gsock.makefile('rb', 0)
Create a self-pipe for the native thread to synchronize on.

This code is taken from the eventlet tpool module, under terms
of the Apache License v2.0.
def _init_events_pipe(self):
    'Create a self-pipe for the native thread to synchronize on.\n\n        This code is taken from the eventlet tpool module, under terms\n        of the Apache License v2.0.\n        '
    self._event_queue = native_Queue.Queue()
    try:
        (rpipe, wpipe) = os.pipe()
        self._event_notify_send = greenio.GreenPipe(wpipe, 'wb', 0)
        self._event_notify_recv = greenio.GreenPipe(rpipe, 'rb', 0)
    except (ImportError, NotImplementedError):
        sock = eventlet_util.__original_socket__(socket.AF_INET, socket.SOCK_STREAM)
        sock.bind(('localhost', 0))
        sock.listen(50)
        csock = eventlet_util.__original_socket__(socket.AF_INET, socket.SOCK_STREAM)
        csock.connect(('localhost', sock.getsockname()[1]))
        (nsock, addr) = sock.accept()
        self._event_notify_send = nsock.makefile('wb', 0)
        gsock = greenio.GreenSocket(csock)
        self._event_notify_recv = gsock.makefile('rb', 0)