#include <dhcp/docsis3_option_defs.h>
#include <exceptions/exceptions.h>
#include <util/buffer.h>
+#include <util/multi_threading_mgr.h>
#include <boost/lexical_cast.hpp>
#include <boost/shared_array.hpp>
const OptionDefContainerPtr&
LibDHCP::getOptionDefs(const std::string& space) {
static mutex local_mutex;
- std::lock_guard<std::mutex> lock(local_mutex);
+ if (MultiThreadingMgr::instance().getMode()) {
+ std::lock_guard<std::mutex> lock(local_mutex);
+ return LibDHCP::getOptionDefs(space);
+ } else {
+ return LibDHCP::getOptionDefs(space);
+ }
+}
+
+const OptionDefContainerPtr&
+LibDHCP::getOptionDefsInternal(const std::string& space) {
// If any of the containers is not initialized, it means that we haven't
// initialized option definitions at all.
if (option_defs_.end() == option_defs_.find(space)) {
static uint32_t optionSpaceToVendorId(const std::string& option_space);
private:
+ /// @brief Returns collection of option definitions.
+ ///
+ /// This method returns a collection of option definitions for a specified
+ /// option space. It must be called in a thread safe scope when MT is enabled.
+ ///
+ /// @param space Option space.
+ ///
+ /// @return Pointer to a collection of option definitions.
+ static const OptionDefContainerPtr& getOptionDefsInternal(const std::string& space);
+
/// Initialize DHCP option definitions.
///
/// The method creates option definitions for all DHCP options.