title: libev's IO watcher runs onto error if underlying FD is closed
body: <p>I'm using <code>libev</code> for watching FD events, but sometimes I need to close the underlying FD.</p>
  <p>Therefore, I'm stopping the IO watcher (by calling its <code>stop</code> function), but it seems not enough, as I'm still getting this error after calling <code>close(fd)</code>:</p>
  <pre><code> ev_epoll.c:134: epoll_modify: Assertion `(&quot;libev: I/O watcher with invalid fd found in epoll_ctl&quot;, errno != EBADF &amp;&amp; errno != ELOOP &amp;&amp; errno != EINVAL)' failed.
  </code></pre>
  <p>How can I make sure to solve this error, if I don't want to delete the <code>ev_loop</code> as it still needs to watch other changes?</p>
  <p>It seems, an IO-watcher added to ev_loop must always have to have a valid (opened) FD, even if it's stopped. Or am I doing something wrong?</p>
  <pre><code>myEVLoop = ev_loop_new(0);
  
  myEVIO.stop();
  myEVIO.set&lt;MyClass, &amp;MyClass::myRead&gt;(this);
  myEVIO.set(myEVLoop);
  
  //... (some other ios and timers, and asyncs)
  
  myEVIO.set(fd, ev::READ);
  myEVIO.start();
  
  IN THREAD1: ev_run(myEVLoop, 0);
  
  IN THREAD2: myEVIO.stop(); close(fd);
  </code></pre>
  <p>After this <code>close</code> call the above error comes. Can I somehow conquer this?</p>