Skip to content

Commit 2d011df

Browse files
alumaedanpovey
authored andcommitted
[src] Fix for threaded nnet2 decoding: check if threads are joinable before calling join(), to avoid multiple calls to join() (#1725)
1 parent c12c1b8 commit 2d011df

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/online2/online-nnet2-decoding-threaded.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,10 @@ void SingleUtteranceNnet2DecoderThreaded::RunDecoderSearch(
374374

375375

376376
void SingleUtteranceNnet2DecoderThreaded::WaitForAllThreads() {
377-
for (int32 i = 0; i < 2; i++) // there are 2 spawned threads.
378-
threads_[i].join();
377+
for (int32 i = 0; i < 2; i++) { // there are 2 spawned threads.
378+
if (threads_[i].joinable())
379+
threads_[i].join();
380+
}
379381
if (error_)
380382
KALDI_ERR << "Error encountered during decoding. See above.";
381383
}

0 commit comments

Comments
 (0)