tsync: fix cond_broadcast/wait race

It is possible for the second sibling to lose the race for the mutex
and miss one of the two cond_broadcast events. Detect this, and lower
the num_waits manually when shutting down the sibling.

Signed-off-by: Kees Cook <keescook@chromium.org>
Merge pull request #6 from kees/tsync

tsync: fix cond_broadcast/wait race