title: How to use kqueue for file monitoring in asyncio?
body: <p>I want to use <a href="https://docs.python.org/3/library/select.html#select.kqueue" rel="nofollow noreferrer">kqueue</a> to monitor files for changes.  I can see how to use select.kqueue() in a threaded way.</p>
  <p>I'm searching for a way to use it with asyncio.  I may have missed something really obvious here.  I know that python uses <a href="https://docs.python.org/3/library/asyncio-platforms.html#macos" rel="nofollow noreferrer">kqueue for asyncio on macos</a>.  I'm happy for any solution to only work when kqueue selector is used.</p>
  <p>So far the only way I can see to do this is create a thread to continually <code>kqueue.control()</code> from another thread and then inject the events in with <code>asyncio.loop.call_soon_threadsafe()</code>.  I feel like there should be a better way.</p>