Harden monitor tests against spurious wakeups.

The monitor tests (1930 - 1934) were slightly flakey due to spurious
wake-ups. This makes them less susceptible to the issue by making
threads go back to sleep if the wake-up seems spurious.

Test: ./test.py --host -j50
Test: stress --cpu 60
Test: while ./test/run-test --host 1933; do; done
Change-Id: I895827e6433f9ab3d2bd5cc3bf10ad0e242ac89d
6 files changed