From 2ee1ca11167686b9a80c812ee1a71c9030628fbb Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Tue, 14 Aug 2018 13:17:10 -0500 Subject: [PATCH] Fix premature deletion of lock in Event.set_callback --- src/wrap_cl.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wrap_cl.hpp b/src/wrap_cl.hpp index ba6a7544..1314a156 100644 --- a/src/wrap_cl.hpp +++ b/src/wrap_cl.hpp @@ -1526,8 +1526,12 @@ namespace pyopencl std::thread notif_thread([cb_info]() { - std::unique_lock ulk(cb_info->m_mutex); - cb_info->m_condvar.wait(ulk); + { + std::unique_lock ulk(cb_info->m_mutex); + cb_info->m_condvar.wait(ulk); + + // ulk no longer held here, cb_info ready for deletion + } { py::gil_scoped_acquire acquire; -- GitLab