Convert from libev to libuv.

libuv has a much nicer interface than libev, as well as a better feature set
(including async I/O, DNS and thread pooling).

This change folds the client thread back into the main thread, so performance
is reduced by about ~50% (to be fixed later).