From b947e4a4ae0e06633b114dd59d447973fc5aaa56 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 20 Oct 2017 18:06:24 +0200 Subject: options/scoped: use raii --- options/scoped.hpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'options/scoped.hpp') diff --git a/options/scoped.hpp b/options/scoped.hpp index f43e9712..117bbf56 100644 --- a/options/scoped.hpp +++ b/options/scoped.hpp @@ -9,6 +9,15 @@ namespace options { +struct OTR_OPTIONS_EXPORT with_tracker_teardown final +{ + with_tracker_teardown(); + ~with_tracker_teardown(); + +private: + bool old_value; +}; + struct OTR_OPTIONS_EXPORT opts { bundle b; @@ -16,13 +25,6 @@ struct OTR_OPTIONS_EXPORT opts opts& operator=(const opts&) = delete; opts(const opts&) = delete; virtual ~opts(); - - // XXX hack: the flag shouldn't be here as action at distance -sh 20160926 - static void set_teardown_flag(bool value); - static bool is_tracker_teardown(); -private: - static std::atomic_bool teardown_flag; - static void ensure_thread(); }; } -- cgit v1.2.3