Only use self pipes when threaded
Events are only managed by the main thread

event_new_fd() is now private.  There's a wrapper function
which takes care of adding the listener to a queue, and signalling
the main thread.