git://git.onelab.eu
/
nodemanager.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
be69c6f
)
Debugging output.
author
Faiyaz Ahmed
<faiyaza@cs.princeton.edu>
Fri, 4 Apr 2008 19:46:46 +0000
(19:46 +0000)
committer
Faiyaz Ahmed
<faiyaza@cs.princeton.edu>
Fri, 4 Apr 2008 19:46:46 +0000
(19:46 +0000)
tools.py
patch
|
blob
|
history
diff --git
a/tools.py
b/tools.py
index
49441bd
..
776a8d4
100644
(file)
--- a/
tools.py
+++ b/
tools.py
@@
-94,6
+94,7
@@
def write_temp_file(do_write, mode=None, uidgid=None):
class NMLock:
def __init__(self, file):
class NMLock:
def __init__(self, file):
+ logger.log("Lock %s initialized." % file, 2)
self.fd = os.open(file, os.O_RDWR|os.O_CREAT, 0600)
flags = fcntl.fcntl(self.fd, fcntl.F_GETFD)
flags |= fcntl.FD_CLOEXEC
self.fd = os.open(file, os.O_RDWR|os.O_CREAT, 0600)
flags = fcntl.fcntl(self.fd, fcntl.F_GETFD)
flags |= fcntl.FD_CLOEXEC
@@
-101,6
+102,8
@@
class NMLock:
def __del__(self):
os.close(self.fd)
def acquire(self):
def __del__(self):
os.close(self.fd)
def acquire(self):
- fcntl.lockf(self.fd, fcntl.LOCK_EX)
+ logger.log("Lock acquired.", 2)
+ fcntl.lockf(self.fd, fcntl.LOCK_SH)
def release(self):
def release(self):
+ logger.log("Lock released.", 2)
fcntl.lockf(self.fd, fcntl.LOCK_UN)
fcntl.lockf(self.fd, fcntl.LOCK_UN)