Rewrite without using Mutex (trigger flush and exit by enqueuing special
symbols instead).
Break out 0MQ messaging into a Sender class with an input request queue for
a cleaner implementation that avoids spawning a new thread for each
request.