Use two condition variables and a mutex to realize message queue