代码拉取完成,页面将自动刷新
From b239a7940f1439d425cb37729fe380db73734856 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=83=91=E6=99=A8=E5=8D=89?= <zhengchenhui1@huawei.com>
Date: Fri, 3 Nov 2023 11:39:12 +0800
Subject: [PATCH 5/7] [Pin-server] Bugfix for the operation sequence of
userOpts.
---
lib/PluginServer/PluginServer.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/PluginServer/PluginServer.cpp b/lib/PluginServer/PluginServer.cpp
index 8778019..9a8d5e5 100644
--- a/lib/PluginServer/PluginServer.cpp
+++ b/lib/PluginServer/PluginServer.cpp
@@ -23,6 +23,7 @@
#include <thread>
#include <fcntl.h>
#include <sys/stat.h>
+#include <mutex>
#include "PluginAPI/PluginServerAPI.h"
#include "user/user.h"
@@ -34,6 +35,8 @@ using namespace PluginOpt;
using std::cout;
using std::endl;
using std::pair;
+
+static std::mutex register_mutex; // 线程锁
PluginServer *PluginServer::pluginServerPtr = nullptr;
PluginServer *PluginServer::GetInstance()
{
@@ -273,6 +276,7 @@ void PluginServer::ParseArgv(const string& data)
void PluginServer::SendRegisteredUserOpts()
{
+ register_mutex.lock();
for (auto it = userOpts.begin(); it != userOpts.end(); it++) {
string key = "injectPoint";
for (auto& userOpt : it->second) {
@@ -286,6 +290,7 @@ void PluginServer::SendRegisteredUserOpts()
}
}
pluginCom.ServerSend("injectPoint", "finished");
+ register_mutex.unlock();
}
void PluginServer::ServerSemPost(const string& port)
@@ -307,8 +312,9 @@ void PluginServer::RunServer()
}
log->LOGI("Server ppid:%d listening on port:%s\n", getppid(), port.c_str());
ServerSemPost(port);
-
+ register_mutex.lock();
RegisterCallbacks();
+ register_mutex.unlock();
log->LOGI("RunServer: RegisterCallbacks Done.\n");
pluginCom.Run();
}
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。