The ev module implements an event loop for files and signals. There's an implicit global event loop accessible via the [[add]], [[del]], [[loop]] and [[loopbreak]] functions as well as the support for manually creating event loop via [[new]] and the methods returned. Signals can be safely catched and the registered callback is called in the main code environment, and not in a signal context, so no special attention is needed. At the moment, signals can only be handled as part of the implicit global event loop. Caveats: if the event A deletes the event B, and the event B is already pending, it can still be fired once.