Summary:
"import crashinfo" was probably failing because multiple dotest invocations
are all trying to compile crashinfo.so at the same time.
I've put a mutex around the compile step to prevent this.
Reviewers: clayborg, chying
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D9732
llvm-svn: 237230
24 lines
512 B
Python
24 lines
512 B
Python
"""
|
|
Interprocess mutex based on file locks
|
|
"""
|
|
|
|
import fcntl
|
|
import os
|
|
|
|
class Lock:
|
|
|
|
def __init__(self, filename):
|
|
self.filename = filename
|
|
# This will create it if it does not exist already
|
|
self.handle = open(filename, 'w')
|
|
|
|
# Bitwise OR fcntl.LOCK_NB if you need a non-blocking lock
|
|
def acquire(self):
|
|
fcntl.flock(self.handle, fcntl.LOCK_EX)
|
|
|
|
def release(self):
|
|
fcntl.flock(self.handle, fcntl.LOCK_UN)
|
|
|
|
def __del__(self):
|
|
self.handle.close()
|