Fork — Fork watcher

class Fork(loop, callback[, data=None, priority=0])
Parameters:
  • loop (Loop) – loop object responsible for this watcher (accessible through loop).
  • callback (callable) – see callback.
  • data (object) – any Python object you might want to attach to the watcher (stored in data).
  • priority (int) – see priority.

Fork watchers are called when a fork() was detected (usually because whoever is a good citizen cared to tell libev about it by calling Loop.reset()). The invocation is done before the event loop blocks next and before Check watchers are being called, and only in the child after the fork. If whoever good citizen calling Loop.reset() cheats and calls it in the wrong process, the fork handlers will be invoked, too, of course.