Perform all the communication between client and server in a dedicated
thread that's started after establishing the connection. The thread
uses a MainLoop instance to read all incoming packets into a queue,
and handle asynchronous requests from the client via
the AddPendingCallback() API.
Using a dedicated thread will make it possible to continuously read
asynchronous notifications from running processes while permitting
the plugin to simultaneously handle synchronous requests in multiprocess
mode.
Sponsored by: The FreeBSD Foundation
TODO:
- implement complete error handling
- implement timeouts