Fixed segfaults related to spurious wakeups

Conditional variables can wake up spuriously, so a predicate
is needed to ignore these cases.
Decreased main thread check interval

Increased the rate at which the main thread checks if the other
threads have finished. The original interval caused too long
of a noticeable delay when threads finished.