File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -57,4 +57,16 @@ void DPCTLEvent_Wait(__dpctl_keep DPCTLSyclEventRef ERef);
5757DPCTL_API
5858void DPCTLEvent_Delete (__dpctl_take DPCTLSyclEventRef ERef);
5959
60+ /* !
61+ * @brief Returns a copy of the DPCTLSyclEventRef object.
62+ *
63+ * @param ERef DPCTLSyclEventRef object to be copied.
64+ * @return A new DPCTLSyclEventRef created by copying the passed in
65+ * DPCTLSyclEventRef object.
66+ * @ingroup EventInterface
67+ */
68+ DPCTL_API
69+ __dpctl_give DPCTLSyclEventRef
70+ DPCTLEvent_Copy (__dpctl_keep const DPCTLSyclEventRef ERef);
71+
6072DPCTL_C_EXTERN_C_END
Original file line number Diff line number Diff line change @@ -47,3 +47,21 @@ void DPCTLEvent_Delete(__dpctl_take DPCTLSyclEventRef ERef)
4747{
4848 delete unwrap (ERef);
4949}
50+
51+ __dpctl_give DPCTLSyclEventRef
52+ DPCTLEvent_Copy (__dpctl_keep DPCTLSyclEventRef ERef)
53+ {
54+ auto SyclEvent = unwrap (ERef);
55+ if (!SyclEvent) {
56+ std::cerr << " Cannot copy DPCTLSyclEventRef as input is a nullptr\n " ;
57+ return nullptr ;
58+ }
59+ try {
60+ auto CopiedSyclEvent = new event (*SyclEvent);
61+ return wrap (CopiedSyclEvent);
62+ } catch (std::bad_alloc const &ba) {
63+ // \todo log error
64+ std::cerr << ba.what () << ' \n ' ;
65+ return nullptr ;
66+ }
67+ }
You can’t perform that action at this time.
0 commit comments