Skip to content

Blocking calls slow down multi-threaded apps #19

Description

@MattClarkson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions