cleanup duplicate code; add lockfree queue for inter-thread rather than interprocess message_queue
lockfree queue and condition variable