Fix GIL issue (see previous commit for details)

This commit is contained in:
Matthias Hochsteger 2024-06-21 11:45:16 +02:00
parent 163135981e
commit af5e003790
2 changed files with 12 additions and 17 deletions

View File

@ -1234,15 +1234,12 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
{
MeshingParameters mp;
if(pars) mp = *pars;
{
py::gil_scoped_acquire acquire;
CreateMPfromKwargs(mp, kwargs);
}
py::gil_scoped_release gil_release;
MeshVolume (mp, self);
OptimizeVolume (mp, self);
}, py::arg("mp")=nullptr,
meshingparameter_description.c_str(),
py::call_guard<py::gil_scoped_release>())
meshingparameter_description.c_str())
.def ("OptimizeVolumeMesh", [](Mesh & self, MeshingParameters* pars)
{

View File

@ -188,7 +188,6 @@ NGCORE_API_EXPORT void ExportSTL(py::module & m)
{
MeshingParameters mp;
STLParameters stlparam;
{ py::gil_scoped_acquire aq;
if(pars)
{
auto mp_flags = pars->geometrySpecificParameters;
@ -198,7 +197,7 @@ NGCORE_API_EXPORT void ExportSTL(py::module & m)
}
CreateSTLParametersFromKwargs(stlparam, kwargs);
CreateMPfromKwargs(mp, kwargs); // this will throw if any kwargs are not passed
}
py::gil_scoped_release gil_release;
if(!mesh)
{
mesh = make_shared<Mesh>();
@ -215,7 +214,6 @@ NGCORE_API_EXPORT void ExportSTL(py::module & m)
return mesh;
}, py::arg("mp") = nullptr, py::arg("mesh") = nullptr,
py::call_guard<py::gil_scoped_release>(),
(meshingparameter_description + stlparameter_description).c_str())
.def("Draw", FunctionPointer
([] (shared_ptr<STLGeometry> self)