Skip to content

Commit

Permalink
Release Python GIL for the region growing to allow Python callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
dokempf committed Nov 10, 2022
1 parent 81c6640 commit 980282c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/py4dgeo/py4dgeo_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,13 @@ PYBIND11_MODULE(_py4dgeo, m)
py::arg("penalty"));

// The main algorithms for the spatiotemporal segmentations
m.def("region_growing", &region_growing);
m.def("region_growing",
[](const RegionGrowingAlgorithmData& data,
const TimeseriesDistanceFunction& distance_function) {
// The region_growing function may call Python callback functions
py::gil_scoped_release release_gil;
return region_growing(data, distance_function);
});
m.def("change_point_detection", &change_point_detection);

// Callback implementations
Expand Down

0 comments on commit 980282c

Please sign in to comment.