We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd8d4f2 commit 0c29a08Copy full SHA for 0c29a08
2 files changed
pdal/plang/Environment.cpp
@@ -114,9 +114,20 @@ EnvironmentPtr Environment::get()
114
115
auto init = []()
116
{
117
+ PyGILState_STATE gstate;
118
+
119
+ // If the interpreter is already initialized, we need to
120
+ // grab the GIL and hold it before we go do any Python
121
+ // stuff
122
+ bool alreadyInitialized(Py_IsInitialized());
123
+ if (alreadyInitialized)
124
+ gstate = PyGILState_Ensure();
125
126
g_environment = new Environment();
127
128
129
+ PyGILState_Release(gstate);
130
};
- gil_scoped_acquire acquire;
131
std::call_once(flag, init);
132
return g_environment;
133
}
pdal/plang/gil.hpp
@@ -45,6 +45,8 @@ class gil_scoped_release {
45
46
47
48
49
50
} // plang
51
52
} // pdal
0 commit comments