Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed threaded deadlock #10

Merged
merged 1 commit into from
Dec 2, 2020
Merged

Conversation

Edwinem
Copy link
Contributor

@Edwinem Edwinem commented Feb 25, 2020

This fixes issue #8

The problem was that when multithreading is enabled a deadlock occurs, due to multiple threads trying to acquire the GIL which is held by the main thread. By adding py::call_guardpy::gil_scoped_release() to the optimize and initialize functions it ensures that the main thread releases the GIL.

This in general should be done for any long running C++ code.

- Added code to release the GIL on NonlinearOptimizer optimize(), and
MarginalCovarianceSolve initialize().
- This is needed to stop a deadlock which happens when multiple threads
are enabled and they all try to aquire the GIL.
@dongjing3309
Copy link
Owner

@Edwinem thanks a lot for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants