title: How to use libuv with a bytecode virtual machine
body: <p>How would you use libuv inside a bytecode virtual machine, say i have this function</p>
  
  <pre class="lang-c prettyprint-override"><code>void vm_run(vm_t* vm);
  </code></pre>
  
  <p>Which starts the virtual machine to execute code it will keep running as long the user's code does so, now i want to add asynchronous stuff in the language VM say a <code>setTimeout</code>/<code>setInterval</code> like JavaScript, i can expose the native function to the user but when to actually start the event loop, <code>uv_run</code> blocks until there's no events left and the VM also blocks until the user's code ends how would i start both together in order to keep the VM doing async I/O, I'm just struggling to understand the idea of an event loop properly in such a context, someone please guide me to the right path.</p>