From b95eccb40d4d603131f77f609f596c3032847cb0 Mon Sep 17 00:00:00 2001 From: Paul David Date: Tue, 17 Jan 2017 18:23:56 -0500 Subject: x300: Output system messages in order for multi-threaded initialization --- host/lib/utils/msg.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'host/lib/utils') diff --git a/host/lib/utils/msg.cpp b/host/lib/utils/msg.cpp index 95879a116..d9d2fb66a 100644 --- a/host/lib/utils/msg.cpp +++ b/host/lib/utils/msg.cpp @@ -78,7 +78,12 @@ void uhd::msg::register_handler(const handler_t &handler){ msg_rs().handler = handler; } -static void default_msg_handler(uhd::msg::type_t type, const std::string &msg){ +const uhd::msg::handler_t& uhd::msg::get_handler(){ + boost::mutex::scoped_lock lock(msg_rs().mutex); + return msg_rs().handler; +} + +void uhd::msg::default_msg_handler(uhd::msg::type_t type, const std::string &msg){ static boost::mutex msg_mutex; boost::mutex::scoped_lock lock(msg_mutex); switch(type){ @@ -104,7 +109,7 @@ static void default_msg_handler(uhd::msg::type_t type, const std::string &msg){ } UHD_STATIC_BLOCK(msg_register_default_handler){ - uhd::msg::register_handler(&default_msg_handler); + uhd::msg::register_handler(&uhd::msg::default_msg_handler); } /*********************************************************************** -- cgit v1.2.3