How to change the behavior of getting a bound method to avoid GIL? #4610
huweiATgithub
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For a C++ class A that is exported to Python:
For multithreaded programs that run
a.f
in multiple threads, one must release GIL in functiong
. Otherwise, a deadlock is presented as other threads runninga.f
will never successfully acquire GIL.Even if one releases GIL in
g
, the multithreaded program is running serially.Would it be possible to change the behavior of
a.f
so that instead of creating a bound method in Python, it creates a bound in C++, and return that function? so that operations on the classA
will achieve nearly the same performance that native C++ has.Beta Was this translation helpful? Give feedback.
All reactions