Skip to content

Commit

Permalink
fix(ipcserver): concurrent access to rime api
Browse files Browse the repository at this point in the history
fixes #1487
  • Loading branch information
lotem committed Feb 6, 2025
1 parent 78e20ab commit 2dc4e19
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion WeaselIPCServer/WeaselServerImpl.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "WeaselServerImpl.h"
#include <mutex>
#include <Windows.h>
#include <resource.h>
#include <WeaselUtility.h>
Expand Down Expand Up @@ -161,15 +162,17 @@ int ServerImpl::Stop() {
return 0;
}

static std::mutex g_api_mutex;

int ServerImpl::Run() {
// This workaround causes a VC internal error:
// void PipeServer::Listen(ServerHandler handler);
//
// auto handler = boost::bind(&ServerImpl::HandlePipeMessage, this);
// auto listener = boost::bind(&PipeServer::Listen, channel.get(), handler);
//

auto listener = [this](PipeMessage msg, PipeServer::Respond resp) -> void {
std::lock_guard guard(g_api_mutex);
HandlePipeMessage(msg, resp);
};
pipeThread = std::make_unique<boost::thread>(
Expand Down

0 comments on commit 2dc4e19

Please sign in to comment.