class NIO::Selector

def wakeup

level-triggered behavior.
has the same effect as invoking it just once. In other words, it provides
Invoking this method more than once between two successive select calls

any such thread exists.
Wake up a thread that's in the middle of selecting on this selector, if
def wakeup
  # Send the selector a signal in the form of writing data to a pipe
  begin
    @waker.write_nonblock "\0"
  rescue IO::WaitWritable
    # This indicates the wakeup pipe is full, which means the other thread
    # has already received many wakeup calls, but not processed them yet.
    # The other thread will completely drain this pipe when it wakes up,
    # so it's ok to ignore this exception if it occurs: we know the other
    # thread has already been signaled to wake up
  end
  nil
end