Skip to content

Commit 902fa01

Browse files
Execute body of host_task if main interpreter is still initialized (#776)
1 parent e5789bf commit 902fa01

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dpctl/_host_task_util.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ int async_dec_ref(DPCTLSyclQueueRef QRef,
5555
*(reinterpret_cast<sycl::event *>(ERefs[ev_id])));
5656
}
5757
cgh.host_task([obj_array_size, obj_vec]() {
58-
{
58+
// if the main thread has not finilized the interpreter yet
59+
if (Py_IsInitialized()) {
5960
PyGILState_STATE gstate;
6061
gstate = PyGILState_Ensure();
6162
for (size_t i = 0; i < obj_array_size; ++i) {

0 commit comments

Comments
 (0)