Suppose I have a C(++) function taking an integer, and it is bound to (C)python with python api, so I can call it from python:
import c_module
c_module.f(10)
now, I want to parallelize it. The problem is: how does the GIL work in this case? Suppose I have a queue of numbers to be processed, and some workers (threading.Thread
) working in parallel, each of them calling c_module.f(number)
where number
is taken from a queue.
The difference with the usual case, when GIL lock the interpreter, is that now you don't need the interpreter to evaluate c_module.f
because it is compiled. So the question is: in this case the processing is really parallel?