Browse Source

perf(CAPI): remove unnecessary atomic

tags/0.1.0
DragonAura 2 years ago
parent
commit
34feec7c99
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      CAPI/API/include/Communication.h
  2. +1
    -1
      CAPI/API/src/Communication.cpp

+ 1
- 1
CAPI/API/include/Communication.h View File

@@ -52,7 +52,7 @@ public:


private: private:
std::unique_ptr<protobuf::AvailableService::Stub> THUAI6Stub; std::unique_ptr<protobuf::AvailableService::Stub> THUAI6Stub;
std::atomic_bool haveNewMessage = false;
bool haveNewMessage = false;
protobuf::MessageToClient message2Client; protobuf::MessageToClient message2Client;
ConcurrentQueue<std::pair<int64_t, std::string>> messageQueue; ConcurrentQueue<std::pair<int64_t, std::string>> messageQueue;
std::mutex mtxMessage; std::mutex mtxMessage;


+ 1
- 1
CAPI/API/src/Communication.cpp View File

@@ -202,7 +202,7 @@ protobuf::MessageToClient Communication::GetMessage2Client()
{ {
std::unique_lock<std::mutex> lock(mtxMessage); std::unique_lock<std::mutex> lock(mtxMessage);
cvMessage.wait(lock, [this]() cvMessage.wait(lock, [this]()
{ return haveNewMessage.load(); });
{ return haveNewMessage; });
haveNewMessage = false; haveNewMessage = false;
return message2Client; return message2Client;
} }


Loading…
Cancel
Save