Condition varable for stoped rotating
This commit is contained in:
parent
fba1c0f977
commit
11e76a4177
@ -93,8 +93,10 @@ class rotor {
|
|||||||
|
|
||||||
{
|
{
|
||||||
unique_lock<mutex> te_l(te_m);
|
unique_lock<mutex> te_l(te_m);
|
||||||
te_cv.wait(te_l, [this]{ return !tcores.empty(); });
|
te_cv.wait(te_l, [this]{ return !tcores.empty() || rotating; });
|
||||||
// calc_next();
|
if (!rotating) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
next_tc = min_element( tcores.begin(), tcores.end(),
|
next_tc = min_element( tcores.begin(), tcores.end(),
|
||||||
[](shared_ptr<timer_core> a, shared_ptr<timer_core> b ) {
|
[](shared_ptr<timer_core> a, shared_ptr<timer_core> b ) {
|
||||||
@ -131,7 +133,7 @@ class rotor {
|
|||||||
void remove(vector<shared_ptr<timer_core>>::iterator it) {
|
void remove(vector<shared_ptr<timer_core>>::iterator it) {
|
||||||
lock_guard<mutex> lock(te_m);
|
lock_guard<mutex> lock(te_m);
|
||||||
tcores.erase(it);
|
tcores.erase(it);
|
||||||
te_cv.notify_one();
|
// te_cv.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user