Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / build / android / pylib / device / decorators.py
index 9362f95..074a0fc 100644 (file)
@@ -9,6 +9,7 @@ Function/method decorators that provide timeout and retry logic.
 import functools
 import os
 import sys
+import threading
 
 from pylib import constants
 from pylib.device import device_errors
@@ -48,7 +49,11 @@ def _TimeoutRetryWrapper(f, timeout_func, retries_func, pass_values=False):
     def impl():
       return f(*args, **kwargs)
     try:
-      return timeout_retry.Run(impl, timeout, retries)
+      if isinstance(threading.current_thread(),
+                    timeout_retry.TimeoutRetryThread):
+        return impl()
+      else:
+        return timeout_retry.Run(impl, timeout, retries)
     except old_errors.WaitForResponseTimedOutError as e:
       raise device_errors.CommandTimeoutError(str(e)), None, (
              sys.exc_info()[2])