Unverified Commit 5c1d1022 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Release GIL when calling getState() (#3061)

parent c9c27264
...@@ -10,6 +10,20 @@ ...@@ -10,6 +10,20 @@
} }
} }
%exception *::getState {
PyThreadState* _savePythonThreadState = PyEval_SaveThread();
try {
$action
} catch (std::exception &e) {
PyEval_RestoreThread(_savePythonThreadState);
PyObject* mm = PyImport_AddModule("openmm");
PyObject* openmm_exception = PyObject_GetAttrString(mm, "OpenMMException");
PyErr_SetString(openmm_exception, const_cast<char*>(e.what()));
return NULL;
}
PyEval_RestoreThread(_savePythonThreadState);
}
%exception *::step { %exception *::step {
PyThreadState* _savePythonThreadState = PyEval_SaveThread(); PyThreadState* _savePythonThreadState = PyEval_SaveThread();
try { try {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment