'Request exit from the ioloop. The loop is NOT guaranteed to stop
before this method returns. This is the only method that may be called
from another thread.'

def stop(self):

    LOGGER.debug('Stopping    IOLoop')
    self._stopping = True
    with self._mutex:
        if (self._w_interrupt is None):
            return
        try:
            self._w_interrupt.send('X')
        except OSError as err:
            if (err.errno != errno.EWOULDBLOCK):
                raise
        except Exception as err:
            LOGGER.warning('Failed    to    send    ioloop    interrupt:    %s', err)
            raise
