Commit 729c92d5 authored by Dominik Charousset's avatar Dominik Charousset

fixed critical bug in shutdown()

parent bc411df8
......@@ -67,7 +67,10 @@ template<typename T>
void stop_and_kill(std::atomic<T*>& ptr) {
for (;;) {
auto p = ptr.load();
if (ptr.compare_exchange_weak(p, nullptr)) {
if (p == nullptr) {
return;
}
else if (ptr.compare_exchange_weak(p, nullptr)) {
p->stop();
delete p;
ptr = nullptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment