void md_config_t::call_all_observers()
{
std::map<md_config_obs_t*,std::set<std::string> > obs;
+ // Have the scope of the lock extend to the scope of
+ // handle_conf_change since that function expects to be called with
+ // the lock held. (And the comment in config.h says that is the
+ // expected behavior.)
+ //
+ // An alternative might be to pass a std::unique_lock to
+ // handle_conf_change and have a version of get_var that can take it
+ // by reference and lock as appropriate.
+ Mutex::Locker l(lock);
{
- Mutex::Locker l(lock);
expand_all_meta();
int _get_val(const std::string &key, char **buf, int len) const;
Option::value_t get_val_generic(const std::string &key) const;
template<typename T> T get_val(const std::string &key) const;
+ template<typename T> T _get_val(const std::string &key) const;
void get_all_keys(std::vector<std::string> *keys) const;
return boost::apply_visitor(gtv, generic_val);
}
+template<typename T> T md_config_t::_get_val(const std::string &key) const {
+ Option::value_t generic_val = this->_get_val(key);
+ get_typed_value_visitor<T> gtv;
+ return boost::apply_visitor(gtv, generic_val);
+}
+
inline std::ostream& operator<<(std::ostream& o, const boost::blank& ) {
return o << "INVALID_CONFIG_VALUE";
}