Better work queue implementation for cpuworkers
Our current implementation for passing work to cpuworkers and getting answers from them is pretty bulletproof: we share an fd with each one, write our requests there as a serialized struct, and get our answers back as serialized struct. The cpuworker learns about new requests by calling read(); we learn about new answers from libevent().
But probably this isn't as efficient as it could be:
- We should have a work queue implementation that doesn't require a cpuworker to wait for the main process to give it more data after each request it answers.
- We should have a work queue implementation that uses condition variables as appropriate to notify cpuworkers of new data.
- We should use appropriate libevent mechanisms notify the main thread of new answers. (There are a bunch of ways to implement a condition variable that wakes libevent; we should pick one.)
- We should manage the communication in-memory rather than over sockets.