Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: build/android/pylib/utils/watchdog_timer.py

Issue 13590002: [Android] Print the stack of deadlocked threads when sharding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: additional '*' * 80 to make frankf happy Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/utils/reraiser_thread_unittest.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """WatchdogTimer timeout objects."""
6
7 import time
8
9
10 class WatchdogTimer(object):
11 """A resetable timeout-based watchdog.
12
13 This object is threadsafe.
14 """
15
16 def __init__(self, timeout):
17 """Initializes the watchdog.
18
19 Args:
20 timeout: The timeout in seconds. If timeout is None it will never timeout.
21 """
22 self._start_time = time.time()
23 self._timeout = timeout
24
25 def Reset(self):
26 """Resets the timeout countdown."""
27 self._start_time = time.time()
28
29 def IsTimedOut(self):
30 """Whether the watchdog has timed out.
31
32 Returns:
33 True if the watchdog has timed out, False otherwise.
34 """
35 if self._timeout is None:
36 return False
37 return time.time() - self._start_time > self._timeout
OLDNEW
« no previous file with comments | « build/android/pylib/utils/reraiser_thread_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698