Skip to content

Commit

Permalink
Release gil before calling on_next
Browse files Browse the repository at this point in the history
  • Loading branch information
dagardner-nv committed Aug 30, 2024
1 parent 7ed6873 commit d808c6e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/mrc/_pymrc/src/segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class SubscriberFuncWrapper : public mrc::pymrc::PythonSource<PyHolder>
try
{
DVLOG(10) << ctx.info() << " Starting source";
AcquireGIL gil;
py::gil_scoped_acquire gil;
py::object py_sub = py::cast(subscriber);
py::iterator py_iter = py::cast<py::iterator>(m_gen_factory(std::move(py_sub)));
PyIteratorWrapper iter_wrapper{std::move(py_iter)};
Expand All @@ -294,6 +294,7 @@ class SubscriberFuncWrapper : public mrc::pymrc::PythonSource<PyHolder>
// Only send if its subscribed. Very important to ensure the object has been moved!
if (subscriber.is_subscribed())
{
py::gil_scoped_release no_gil;
subscriber.on_next(std::move(next_val));
}
else
Expand Down

0 comments on commit d808c6e

Please sign in to comment.