From af86015d724e5edf001aa024fe7d8581c45cffd9 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期四, 15 四月 2021 10:44:12 +0800
Subject: [PATCH] fix sendq lock, use different mutexes for in,out.

---
 src/defs.cpp |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/defs.cpp b/src/defs.cpp
index 4051196..bab2e53 100644
--- a/src/defs.cpp
+++ b/src/defs.cpp
@@ -23,8 +23,31 @@
 const MQId kBHTopicReqRepCenter = boost::uuids::string_generator()("12345670-89ab-cdef-8349-1234567890ff");
 const MQId kBHUniCenter = boost::uuids::string_generator()("87654321-89ab-cdef-8349-1234567890ff");
 
+struct LastError {
+	int ec_ = 0;
+	std::string msg_;
+};
+
+LastError &LastErrorStore()
+{
+	thread_local LastError le;
+	return le;
+}
+
 } // namespace
 
-const MQId &BHTopicBus() { return kBHTopicBus; }
-const MQId &BHTopicReqRepCenter() { return kBHTopicReqRepCenter; }
-const MQId &BHUniCenter() { return kBHUniCenter; }
+const MQId &BHTopicBusAddress() { return kBHTopicBus; }
+const MQId &BHTopicCenterAddress() { return kBHTopicReqRepCenter; }
+const MQId &BHUniCenterAddress() { return kBHUniCenter; }
+
+void SetLastError(const int ec, const std::string &msg)
+{
+	LastErrorStore().ec_ = ec;
+	LastErrorStore().msg_ = msg;
+}
+
+void GetLastError(int &ec, std::string &msg)
+{
+	ec = LastErrorStore().ec_;
+	msg = LastErrorStore().msg_;
+}
\ No newline at end of file

--
Gitblit v1.8.0