Merge pull request #5 from kees/tsync

tsync: unlock mutex on failure
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>