Event Creation and Destruction

The following is the sample code for creating and destroying two events, which is used only to describe how to use events and cannot be directly copied for compilation or running. For the complete sample code, click here.

1
2
3
4
5
6
7
8
9
aclrtEvent startEvent;
aclrtEvent endEvent;
// Create an event. Pass the ACL_EVENT_SYNC parameter to the API, indicating that the created event is used for synchronization.
aclrtCreateEventExWithFlag(&startEvent, ACL_EVENT_SYNC);
aclrtCreateEventExWithFlag(&endEvent, ACL_EVENT_SYNC);
......
// Destroy the event.
aclrtDestroyEvent(startEvent);
aclrtDestroyEvent(endEvent);