Skip to content

Commit

Permalink
Add Join() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Connor committed Oct 26, 2024
1 parent 94c2816 commit f131f78
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/zm_analysis_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ void AnalysisThread::Start() {
void AnalysisThread::Stop() {
terminate_ = true;
}
void AnalysisThread::Join() {
if (thread_.joinable()) thread_.join();
}

void AnalysisThread::Run() {
while (!(terminate_ or zm_terminate)) {
Expand Down
1 change: 1 addition & 0 deletions src/zm_analysis_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class AnalysisThread {

void Start();
void Stop();
void Join();
bool Stopped() const { return terminate_; }

private:
Expand Down
4 changes: 4 additions & 0 deletions src/zm_decoder_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ void DecoderThread::Stop() {
terminate_ = true;
}

void DecoderThread::Join() {
if (thread_.joinable()) thread_.join();
}

void DecoderThread::Run() {
Debug(2, "DecoderThread::Run() for %d", monitor_->Id());

Expand Down
1 change: 1 addition & 0 deletions src/zm_decoder_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class DecoderThread {

void Start();
void Stop();
void Join();

private:
void Run();
Expand Down

0 comments on commit f131f78

Please sign in to comment.