I was debugging a multi-threaded app.
Basically, ndicapi is blocking when doing I/O, and we could do with something like the following conceptual code:
static PyObject* Py_ndiCommand(PyObject* self, PyObject* args) {
// ... parse args (needs GIL) ...
Py_BEGIN_ALLOW_THREADS
ndiCommand(device, command); // blocking serial I/O — safe without GIL
Py_END_ALLOW_THREADS
// ... build return value (needs GIL) ...
return result;
}
i.e. allow Python to release the GIL, which would help multi-threading, as it currently blocks.
I was debugging a multi-threaded app.
Basically, ndicapi is blocking when doing I/O, and we could do with something like the following conceptual code:
static PyObject* Py_ndiCommand(PyObject* self, PyObject* args) {
// ... parse args (needs GIL) ...
Py_BEGIN_ALLOW_THREADS
ndiCommand(device, command); // blocking serial I/O — safe without GIL
Py_END_ALLOW_THREADS
// ... build return value (needs GIL) ...
return result;
}
i.e. allow Python to release the GIL, which would help multi-threading, as it currently blocks.