From b5a50bb863719840da43941a78d28b094ef5e5e9 Mon Sep 17 00:00:00 2001 From: philippegorley <philippe.gorley@savoirfairelinux.com> Date: Tue, 27 Jun 2017 17:53:31 -0400 Subject: [PATCH] smartools: add destructor to call ThreadLoop::join() Change-Id: I31c5103f78fa2516eff930ed874856589206b9c7 --- src/smartools.cpp | 5 +++++ src/smartools.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/smartools.cpp b/src/smartools.cpp index 5325af727f..c6b756cfb9 100644 --- a/src/smartools.cpp +++ b/src/smartools.cpp @@ -39,6 +39,11 @@ Smartools::Smartools() : loop_([this] { return true; }, [this] { process(); }, [] {}) {} +Smartools::~Smartools() +{ + loop_.join(); +} + void Smartools::sendInfo() { diff --git a/src/smartools.h b/src/smartools.h index 0d9a1f642d..23af6e1aad 100644 --- a/src/smartools.h +++ b/src/smartools.h @@ -40,6 +40,7 @@ class Smartools private: Smartools(); + ~Smartools(); void process(); std::map<std::string, std::string> information_; std::mutex mutexInfo_; // Protect information_ from multithreading -- GitLab