Skip to content

Commit 3baa222

Browse files
committed
fix write gil
1 parent d57e88e commit 3baa222

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pyWrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void PyWrapper::StartMonitorWrapperClass(std::string wrapperFileAbs) {
205205
s.push_back(wrapperFileAbs);
206206
std::map <std::string, EventHandle> funs;
207207

208-
// 变化后,重载wrapper
208+
/** 变化后,重载wrapper **/
209209
funs.insert({"IN_MOVE_SELF", reloadWrapper});
210210
ino->InitWatchFile(s, this);
211211
int ret = ino->StartWatchThread(funs, _pid);
@@ -230,7 +230,7 @@ int PyWrapper::wrapperInit(std::map <std::string, std::string> config) {
230230
catch (py::error_already_set &e) {
231231
spdlog::get("stderr_console")->error("_wrapperInit error_already_set error: {}", e.what());
232232
return -1;
233-
}
233+
}
234234
}
235235

236236
int PyWrapper::wrapperFini() {

wrapper.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ int WrapperAPI wrapperWrite(const void *handle, pDataList reqData) {
239239
}
240240
std::string sid = GetHandleSid((char *) handle);
241241
spdlog::debug("call wrapper wrapperWrite: building req data, data num:{},sid:{}", dataNum, sid);
242+
py::gil_scoped_acquire acquire;
242243

243244
DataListCls req;
244245
pDataList p = reqData;
@@ -269,6 +270,7 @@ int WrapperAPI wrapperWrite(const void *handle, pDataList reqData) {
269270
}
270271

271272
int WrapperAPI wrapperRead(const void *handle, pDataList *respData) {
273+
py::gil_scoped_acquire acquire;
272274
int ret = 0;
273275
std::string sid = GetHandleSid((char *) handle);
274276
// 构造响应数据

0 commit comments

Comments
 (0)