Skip to content

Commit

Permalink
fix stopping condition
Browse files Browse the repository at this point in the history
  • Loading branch information
kpedro88 committed Sep 18, 2018
1 parent 638b206 commit 9b847af
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions AnalysisFW/src/TFClientRemote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,22 @@ JetImageData::JetImageData() :

JetImageData::~JetImageData() {
stop_ = true;
cond_.notify_one();
if(thread_){
thread_->join();
thread_.reset();
}
}

void JetImageData::waitForNext(){
while(!stop_){
while(true){
//wait for condition
{
std::unique_lock<std::mutex> lk(mutex_);
cond_.wait(lk, [this](){return hasCall_;});
cond_.wait(lk, [this](){return (hasCall_ or stop_);});
lk.unlock();
}
if(stop_) break;

//items for grpc request
PredictRequest request;
Expand Down

0 comments on commit 9b847af

Please sign in to comment.