From 2a1b05dc05d05aa499915f2bf1423999a85f2d48 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Oct 2020 20:30:20 +0530 Subject: [PATCH] Allow threads while listening for connections on a pipe --- src/calibre/utils/windows/winutil.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/utils/windows/winutil.cpp b/src/calibre/utils/windows/winutil.cpp index 4917abc64d..59a457f38a 100644 --- a/src/calibre/utils/windows/winutil.cpp +++ b/src/calibre/utils/windows/winutil.cpp @@ -709,7 +709,11 @@ static PyObject * connect_named_pipe(PyObject *self, PyObject *args) { HANDLE handle; if (!PyArg_ParseTuple(args, "O&", convert_handle, &handle)) return NULL; - if (!ConnectNamedPipe(handle, NULL)) return set_error_from_handle(args); + BOOL ok; + Py_BEGIN_ALLOW_THREADS; + ok = ConnectNamedPipe(handle, NULL) + Py_END_ALLOW_THREADS; + if (!ok) return set_error_from_handle(args); Py_RETURN_NONE; }