summaryrefslogtreecommitdiff
path: root/Tools/Scripts/webkitpy/common/system/file_lock.py
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Tools/Scripts/webkitpy/common/system/file_lock.py
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Tools/Scripts/webkitpy/common/system/file_lock.py')
-rw-r--r--Tools/Scripts/webkitpy/common/system/file_lock.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Tools/Scripts/webkitpy/common/system/file_lock.py b/Tools/Scripts/webkitpy/common/system/file_lock.py
index b4bfffc40..c542777f2 100644
--- a/Tools/Scripts/webkitpy/common/system/file_lock.py
+++ b/Tools/Scripts/webkitpy/common/system/file_lock.py
@@ -43,20 +43,20 @@ class FileLock(object):
self._max_wait_time_sec = max_wait_time_sec
def _create_lock(self):
- if sys.platform.startswith('linux') or sys.platform in ('darwin', 'cygwin'):
- import fcntl
- fcntl.flock(self._lock_file_descriptor, fcntl.LOCK_EX | fcntl.LOCK_NB)
- elif sys.platform == 'win32':
+ if sys.platform == 'win32':
import msvcrt
msvcrt.locking(self._lock_file_descriptor, msvcrt.LK_NBLCK, 32)
+ else:
+ import fcntl
+ fcntl.flock(self._lock_file_descriptor, fcntl.LOCK_EX | fcntl.LOCK_NB)
def _remove_lock(self):
- if sys.platform.startswith('linux') or sys.platform in ('darwin', 'cygwin'):
- import fcntl
- fcntl.flock(self._lock_file_descriptor, fcntl.LOCK_UN)
- elif sys.platform == 'win32':
+ if sys.platform == 'win32':
import msvcrt
msvcrt.locking(self._lock_file_descriptor, msvcrt.LK_UNLCK, 32)
+ else:
+ import fcntl
+ fcntl.flock(self._lock_file_descriptor, fcntl.LOCK_UN)
def acquire_lock(self):
self._lock_file_descriptor = os.open(self._lock_file_path, os.O_TRUNC | os.O_CREAT)