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()
52
52
void DPCTLEvent_Wait (__dpctl_keep DPCTLSyclEventRef ERef)
53
53
{
54
54
// \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
+ }
57
64
}
58
65
59
66
void 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
56
56
}
57
57
};
58
58
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
+
59
71
TEST_F (TestDPCTLSyclEventInterface, CheckEvent_Copy)
60
72
{
61
73
DPCTLSyclEventRef Copied_ERef = nullptr ;
You can’t perform that action at this time.
0 commit comments