Added guards against spurious wakeups from
pthread_cond_wait()/pthread_cond_timedwait() in monitor.c. (#558)