diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-10-20 18:06:24 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-10-20 18:06:33 +0200 |
commit | b947e4a4ae0e06633b114dd59d447973fc5aaa56 (patch) | |
tree | 7933c169ed263f30ef0389f2059da14e3c5ad933 /options/scoped.hpp | |
parent | 39e209983bd1f04fb0beefef754d7430c8b7fb9f (diff) |
options/scoped: use raii
Diffstat (limited to 'options/scoped.hpp')
-rw-r--r-- | options/scoped.hpp | 16 |
1 files changed, 9 insertions, 7 deletions
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(); }; } |