Changeset View
Changeset View
Standalone View
Standalone View
src/eventloop.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
bool EventLoop::stopEventLoop() { | bool EventLoop::stopEventLoop() { | ||||
WAIT_LOCK(cs_running, lock); | WAIT_LOCK(cs_running, lock); | ||||
if (!running) { | if (!running) { | ||||
return false; | return false; | ||||
} | } | ||||
// Request avalanche to stop. | // Request event loop to stop. | ||||
stopRequest = true; | stopRequest = true; | ||||
// Wait for avalanche to stop. | // Wait for event loop to stop. | ||||
cond_running.wait(lock, [this]() EXCLUSIVE_LOCKS_REQUIRED(cs_running) { | cond_running.wait(lock, [this]() EXCLUSIVE_LOCKS_REQUIRED(cs_running) { | ||||
return !running; | return !running; | ||||
}); | }); | ||||
stopRequest = false; | stopRequest = false; | ||||
return true; | return true; | ||||
} | } |