OSDN Git Service

Fix false alarm on thread suspend timeout
authortony.ys_liu <tony.ys_liu@htc.com>
Wed, 14 Jan 2015 10:28:03 +0000 (18:28 +0800)
committerSimon Wilson <simonwilson@google.com>
Wed, 11 Feb 2015 17:18:06 +0000 (17:18 +0000)
commit227dfb0a25d020f0571eb194b98eca350bd6d036
tree3fca5f563f0ac29e7043c38ad8e08270d349a699
parentc1bfaa22570b4f771ae1cd832201b01ec84e32c1
Fix false alarm on thread suspend timeout

Root cause:
  CLOCK_REALTIME will jump backward/forward when system time-of-day clock is changed.
  It implies now_abs_ts will jump a lot across end_abs_ts.
  Then, it makes a false alarm (process crash) on thread suspend timeout when doing ComputeRelativeTimeSpec.

      if (ComputeRelativeTimeSpec(&rel_ts, end_abs_ts, now_abs_ts)) {
        return false;  // Timed out.
      }

Solution:
  Use CLOCK_MONOTONIC instead

Bug: 19296054
Bug: 19268145

(cherry picked from commit 071e48ecfc95b1c67b07c975190d51f646ac4276)

Change-Id: I68fa5afda75e53373e836dd7779821aeb6f1bd46
(cherry picked from commit 7d9ad8bb71df2b1dc957121ef2ebee69d96f8e0c)
runtime/base/mutex.cc