Fixed bugs with condition variables and waiting due to not guarding against spontaneous wake-ups. We now also verify that the thread has received the signal before continuing to send other signals.