-
Notifications
You must be signed in to change notification settings - Fork 6
Description
By default PyBind11 holds Python's global interpreter lock during C++ calls. We can explicitly release and then re-acquire the GIL around bound functions, allowing multiple Python threads to run PyVXL functions concurrently. This is a helpful feature in Terra DSM. As more and more functions are used by Terra DSM, we GIL scope more and more PyVXL functions. Are there drawbacks to this? I figured we could discuss this here. If the pros outweight the cons, should we just gil scope every PyVXL function by default?
One drawback is if in the future we were ever to call Python code from a bound C++ function, we would need the function to be careful about re-acquiring the GIL.
Relevant docs: https://pybind11.readthedocs.io/en/stable/advanced/misc.html#global-interpreter-lock-gil