diff options
author | Michael Denkowski <mdenkows@cs.cmu.edu> | 2013-09-26 14:28:42 -0700 |
---|---|---|
committer | Michael Denkowski <mdenkows@cs.cmu.edu> | 2013-09-26 14:28:42 -0700 |
commit | ce358ecd6f5132f8bdbbda2272ff4f04ff883e30 (patch) | |
tree | b5f2e114df1c8f23e9727c113e3ccf6d2964da29 /realtime/rt/aligner.py | |
parent | 0d0db26fff5cec36397d81a4f1d15e4efea29f73 (diff) |
FIFO Locks
Diffstat (limited to 'realtime/rt/aligner.py')
-rw-r--r-- | realtime/rt/aligner.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/realtime/rt/aligner.py b/realtime/rt/aligner.py index a14121db..62ce32b8 100644 --- a/realtime/rt/aligner.py +++ b/realtime/rt/aligner.py @@ -31,7 +31,7 @@ class ForceAligner: self.tools = util.popen_io(tools_cmd) # Used to guarantee thread safety - self.semaphore = threading.Semaphore() + self.lock = util.FIFOLock() def align(self, source, target): '''Threadsafe''' @@ -39,7 +39,7 @@ class ForceAligner: def align_formatted(self, line): '''Threadsafe''' - self.semaphore.acquire() + self.lock.acquire() self.fwd_align.stdin.write('{}\n'.format(line)) self.rev_align.stdin.write('{}\n'.format(line)) # f words ||| e words ||| links ||| score @@ -48,7 +48,7 @@ class ForceAligner: self.tools.stdin.write('{}\n'.format(fwd_line)) self.tools.stdin.write('{}\n'.format(rev_line)) al_line = self.tools.stdout.readline().strip() - self.semaphore.release() + self.lock.release() return al_line def close(self): |