File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -52,8 +52,15 @@ __dpctl_give DPCTLSyclEventRef DPCTLEvent_Create()
5252void DPCTLEvent_Wait (__dpctl_keep DPCTLSyclEventRef ERef)
5353{
5454 // \todo How to handle errors? E.g. when ERef is null or not a valid event.
55- auto SyclEvent = unwrap (ERef);
56- SyclEvent->wait ();
55+ if (ERef) {
56+ auto SyclEvent = unwrap (ERef);
57+ if (SyclEvent)
58+ SyclEvent->wait ();
59+ }
60+ else {
61+ std::cerr << " Cannot wait for the event. DPCTLSyclEventRef as input is "
62+ " a nullptr\n " ;
63+ }
5764}
5865
5966void DPCTLEvent_Delete (__dpctl_take DPCTLSyclEventRef ERef)
Original file line number Diff line number Diff line change @@ -56,6 +56,18 @@ struct TestDPCTLSyclEventInterface : public ::testing::Test
5656 }
5757};
5858
59+ TEST_F (TestDPCTLSyclEventInterface, CheckEvent_Wait)
60+ {
61+ EXPECT_NO_FATAL_FAILURE (DPCTLEvent_Wait (ERef));
62+ }
63+
64+ TEST_F (TestDPCTLSyclEventInterface, CheckWait_Invalid)
65+ {
66+ DPCTLSyclEventRef E = nullptr ;
67+ EXPECT_NO_FATAL_FAILURE (DPCTLEvent_Wait (E));
68+ EXPECT_NO_FATAL_FAILURE (DPCTLEvent_Delete (E));
69+ }
70+
5971TEST_F (TestDPCTLSyclEventInterface, CheckEvent_Copy)
6072{
6173 DPCTLSyclEventRef Copied_ERef = nullptr ;
You can’t perform that action at this time.
0 commit comments