Skip to content
Snippets Groups Projects
Commit b45bc73a authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Try to make clSetEventCallback callback lambda have stdcall

parent 528e81f3
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -40,14 +40,21 @@ public: ...@@ -40,14 +40,21 @@ public:
try { try {
pyopencl_call_guarded( pyopencl_call_guarded(
clSetEventCallback, PYOPENCL_CL_CASTABLE_THIS, type, clSetEventCallback, PYOPENCL_CL_CASTABLE_THIS, type,
[] (cl_event, cl_int status, void *data) { static_cast<void (CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *)>(
rm_ref_t<Func> *func = static_cast<rm_ref_t<Func>*>(data); [] (cl_event, cl_int status, void *data) {
std::thread t([func, status] () { rm_ref_t<Func> *func = static_cast<rm_ref_t<Func>*>(data);
(*func)(status);
delete func; // We won't necessarily be able to acquire the GIL inside this
}); // handler without deadlocking. Create a thread that *can*
t.detach(); // wait.
}, (void*)func);
std::thread t([func, status] () {
(*func)(status);
delete func;
});
t.detach();
}), (void*)func);
} catch (...) { } catch (...) {
delete func; delete func;
throw; throw;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment