Rename wake_up() to notify_one()

To align to C++ std::thread conventions.

No functional change.
Retire Threads wake_up() and sleep()

These functions are used in just one place.
And generalize wait_for_stop()

No functional change.
Retire obsolete race hack

This hack was introduced in d282cf6964d493
to workaround a race with start_searching(),
but these days is no more needed.

No functional change.