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

Unified Diff: gclient_utils.py

Issue 8353010: Workaround a limitation in cygwin with Lock creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
diff --git a/gclient_utils.py b/gclient_utils.py
index 0dcef9df0985745d03109a4f7c4640641ad8c62c..918b489c7b3e244f0b4adfd34a5986f66934d8ba 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -480,17 +480,14 @@ def lockedmethod(method):
class WorkItem(object):
"""One work item."""
+ # On cygwin, creating a lock throwing randomly when nearing ~100 locks.
+ # As a workaround, use a single lock. Yep you read it right. Single lock for
+ # all the 100 objects.
+ lock = threading.Lock()
+
def __init__(self, name):
# A unique string representing this work item.
self._name = name
- try:
- self.lock = threading.Lock()
- except: # pylint: disable=W0702
- if sys.platform != 'cygwin':
- raise
- # On cygwin, it's throwing randomly. Hack and reuse the single
- # sys.stdout.lock. Yep you read it right. Single lock.
- self.lock = sys.stdout.lock
Dirk Pranke 2011/10/19 19:40:45 so what happens if threading.Lock() fails an excep
M-A Ruel 2011/10/19 19:47:56 The problem that I started seeing is that while th
def run(self, work_queue):
"""work_queue is passed as keyword argument so it should be
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698