summaryrefslogtreecommitdiffhomepage
path: root/options/scoped.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'options/scoped.hpp')
-rw-r--r--options/scoped.hpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/options/scoped.hpp b/options/scoped.hpp
index 8652bfff..81e6bd19 100644
--- a/options/scoped.hpp
+++ b/options/scoped.hpp
@@ -1,28 +1,39 @@
#pragma once
#include "bundle.hpp"
+#include "value.hpp"
#include <QString>
#include "export.hpp"
-#include <atomic>
-
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
{
+ template<typename t> using value = options::value<t>;
+ using bundle = options::bundle;
+
bundle b;
- opts(const QString& name);
+
opts& operator=(const opts&) = delete;
opts(const opts&) = delete;
- ~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();
+ void set_raii_dtor_state(bool x) { raii = x; }
+
+protected:
+ explicit opts(const QString& name);
+ ~opts();
private:
- static std::atomic_bool teardown_flag;
- static void ensure_thread();
+ bool raii = true;
};
}