From c05be59a45839bfb2a20d399812e677ef4df1e70 Mon Sep 17 00:00:00 2001 From: huangfeijie Date: Mon, 26 Sep 2022 21:34:44 +0800 Subject: [PATCH] issue:https://gitee.com/openharmony/arkcompiler_toolchain/issues/I5T8TS Fix the interface of SendReply Add lock for the SendReply Signed-off-by: huangfeijie --- inspector/ws_server.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inspector/ws_server.cpp b/inspector/ws_server.cpp index f1d7b1ce..fbe802b3 100644 --- a/inspector/ws_server.cpp +++ b/inspector/ws_server.cpp @@ -17,11 +17,14 @@ #include #include +#include #include #include "hilog_wrapper.h" namespace OHOS::ArkCompiler::Toolchain { +std::shared_mutex g_mutex; + void WsServer::RunServer() { terminateExecution_ = false; @@ -99,6 +102,7 @@ void WsServer::StopServer() void WsServer::SendReply(const std::string& message) const { + std::unique_lock lock(g_mutex); if (webSocket_ == nullptr) { LOGE("WsServer SendReply websocket has been closed unexpectedly"); return; -- Gitee