condition_variable: fix fallout from commit 038c3eb for macOS

Normally pthread_cond_timedwait expects wallclock time in the 'abstime'
parameter, and on macOS, it's not possible to change that to monotonic time.
As a result, commit 038c3eb caused all sorts of timing issues on macOS for
any code doing deadline-based waiting on condition variables. As an example,
ThreadJoiner configured to wait in 1000ms increments would instead use 10us
increments. This patch fixes this by switching back to relative time
waiting, as was done in ConditionVariable::TimedWait prior to that commit.

I tried doing the same on Linux so as to chain WaitUntil into WaitFor, but
that leads to overflows when the deadline is Max() due to a subtraction and
then an addition of potentially different values of Now().

Change-Id: If33329376af7a350e66c1d26c7bb57d7e5416236
Reviewed-on: http://gerrit.cloudera.org:8080/9695
Reviewed-by: Dan Burkert <danburkert@apache.org>
Tested-by: Adar Dembo <adar@cloudera.com>
Reviewed-by: Todd Lipcon <todd@apache.org>
(cherry picked from commit a469506115fbc13c1fe835ae9c1a75a5544bf64e)
Reviewed-on: http://gerrit.cloudera.org:8080/9699
Reviewed-by: Adar Dembo <adar@cloudera.com>
1 file changed