Projects
home:Eustace:branches:Eulaceura:Factory
pin-server
_service:obs_scm:0032-Pin-server-Bugfix-for-the...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0032-Pin-server-Bugfix-for-the-operation-sequence-of-user.patch of Package pin-server
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
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2