Search code examples
c++cnode.jslibuv

libuv event loop: prepare handle and check handle usage


What is the reason to invoke the prepare handle callback and the check handle callback in the libuv event loop?


Solution

  • The i/o operations happen between those 2, so you may want to perform some operation before blocking for i/o (prepare handles), and after i/o (check handles).

    This diagram illustrates how the libuv event loop operates internally: http://docs.libuv.org/en/v1.x/design.html#the-i-o-loop