diff options
author | Linus Nordberg <linus@nordu.net> | 2016-11-25 23:53:36 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-11-25 23:53:36 +0100 |
commit | a3b424a4799851d02298e226e5a582fa1f4e8aad (patch) | |
tree | 6c4e377928de48f18f295ed6a16d4bc2323a1f38 /tools/mergetools.py | |
parent | c070573e5cc6bc21653ebb82d8f64b7ef44ae9ef (diff) |
merge_fetch: Write to chainsdb in controlling process.
Multiple writers won't work when using permdb.
Also, improve throughput by polling worker processes with timeout 0
and read all messages at once.
Diffstat (limited to 'tools/mergetools.py')
-rw-r--r-- | tools/mergetools.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/tools/mergetools.py b/tools/mergetools.py index d5d5f75..1334186 100644 --- a/tools/mergetools.py +++ b/tools/mergetools.py @@ -484,25 +484,6 @@ def flock_ex_or_fail(path): return False return True -def flock_ex_wait(path): - fd = os.open(path, os.O_CREAT) - logging.debug("waiting for exclusive lock on %s (%s)", fd, path) - fcntl.flock(fd, fcntl.LOCK_EX) - logging.debug("taken exclusive lock on %s", fd) - return fd - -def flock_sh_wait(path): - fd = os.open(path, os.O_CREAT) - logging.debug("waiting for shared lock on %s (%s)", fd, path) - fcntl.flock(fd, fcntl.LOCK_SH) - logging.debug("taken shared lock on %s", fd) - return fd - -def flock_release(fd): - logging.debug("releasing lock on %s", fd) - fcntl.flock(fd, fcntl.LOCK_UN) - os.close(fd) - def terminate_child_procs(): for p in multiprocessing.active_children(): #print >>sys.stderr, "DEBUG: terminating pid", p.pid @@ -522,12 +503,6 @@ class FileDB: return read_chain(self.path, key) def add(self, key, value): return write_chain(key, value, self.path) - def lock_sh(self): - self.lockfile = flock_sh_wait(self.path + "/.lock") - def lock_ex(self): - self.lockfile = flock_ex_wait(self.path + "/.lock") - def release_lock(self): - flock_release(self.lockfile) def commit(self): pass @@ -538,12 +513,6 @@ class PermDB: return permdb.getvalue(self.permdbobj, key) def add(self, key, value): return permdb.addvalue(self.permdbobj, key, value) - def lock_sh(self): - assert False # NYI - def lock_ex(self): - assert False # NYI - def release_lock(self): - assert False # NYI def commit(self): permdb.committree(self.permdbobj) |