fix(simu): removed useless stop condition and mutex
This commit is contained in:
@@ -52,18 +52,11 @@ void timer_queue::start()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void timer_queue::stop() {
|
void timer_queue::stop() {
|
||||||
bool stopping = false;
|
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lock(_cmds_mutex);
|
std::unique_lock<std::mutex> lock(_cmds_mutex);
|
||||||
std::unique_lock<std::mutex> slock(_stop_mutex);
|
|
||||||
|
|
||||||
if (_running) {
|
if (_running) {
|
||||||
stopping = true;
|
|
||||||
_running = false;
|
_running = false;
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
_cmds_condition.notify_one();
|
_cmds_condition.notify_one();
|
||||||
_stop_condition.wait(slock);
|
|
||||||
slock.unlock();
|
|
||||||
}
|
}
|
||||||
_thread->join();
|
_thread->join();
|
||||||
TRACE("<timer_queue> stopped");
|
TRACE("<timer_queue> stopped");
|
||||||
@@ -127,8 +120,6 @@ void timer_queue::main_loop() {
|
|||||||
async_calls();
|
async_calls();
|
||||||
trigger_timers();
|
trigger_timers();
|
||||||
}
|
}
|
||||||
|
|
||||||
_stop_condition.notify_one();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer_queue::process_cmds()
|
void timer_queue::process_cmds()
|
||||||
|
|||||||
@@ -37,9 +37,6 @@ class timer_queue {
|
|||||||
std::mutex _cmds_mutex;
|
std::mutex _cmds_mutex;
|
||||||
std::condition_variable _cmds_condition;
|
std::condition_variable _cmds_condition;
|
||||||
|
|
||||||
std::mutex _stop_mutex;
|
|
||||||
std::condition_variable _stop_condition;
|
|
||||||
|
|
||||||
std::vector<timer_handle_t*> _timers;
|
std::vector<timer_handle_t*> _timers;
|
||||||
std::vector<timer_async_call_t> _funcs;
|
std::vector<timer_async_call_t> _funcs;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user