From a5cf7bd7e6750ba3d8ed89a22466997adfbf7e6a Mon Sep 17 00:00:00 2001 From: ctiller <ctiller@google.com> Date: Fri, 9 Jan 2015 09:15:02 -0800 Subject: [PATCH] Remove mutex as this process is now single threaded Change on 2015/01/09 by ctiller <ctiller@google.com> ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=83610407 --- tools/run_tests/watch_dirs.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tools/run_tests/watch_dirs.py b/tools/run_tests/watch_dirs.py index 8ebbb27180..056e69a16c 100755 --- a/tools/run_tests/watch_dirs.py +++ b/tools/run_tests/watch_dirs.py @@ -1,7 +1,6 @@ """Helper to watch a (set) of directories for modifications.""" import os -import threading import time @@ -11,7 +10,6 @@ class DirWatcher(object): def __init__(self, paths): if isinstance(paths, basestring): paths = [paths] - self._mu = threading.Lock() self._done = False self.paths = list(paths) self.lastrun = time.time() @@ -35,12 +33,8 @@ class DirWatcher(object): return most_recent_change def most_recent_change(self): - self._mu.acquire() - try: - if time.time() - self.lastrun > 1: - self._cache = self._calculate() - self.lastrun = time.time() - return self._cache - finally: - self._mu.release() + if time.time() - self.lastrun > 1: + self._cache = self._calculate() + self.lastrun = time.time() + return self._cache -- GitLab