// To avoid delay issue of calling usleep(), this function decreases
// the count if the gmain threads exists.
if (GetThreadName(tid) == "gmain") {
- _W("%d is gmain thread", tid);
+ _D("%d is gmain thread", tid);
count--;
}
}
auto& inst = ThreadControl::GetInst();
std::unique_lock<std::mutex> lock(inst.mutex_);
inst.count_--;
- inst.cond_.wait(lock, [&] { return inst.done_; });
+ if (inst.cond_.wait_for(lock, std::chrono::seconds(5),
+ [&] { return inst.done_; }))
+ _D("Unblock");
+ else
+ _E("Timed out");
inst.count_--;
- _D("Unblock");
}
} // namespace launchpad