Event Synchronization

Following the API calls, add exception handling branches and specify log printing of error and information levels. The following is a code snippet of key steps only, which is not ready to use.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import acl
# ......
# Create an event.
event, ret = acl.rt.create_event()

# Create a stream.
stream, ret = acl.rt.create_stream()

# Append an event to a stream.
ret = acl.rt.record_event(event, stream)

# Block the application execution and wait until the event is complete, that is, the completion of the stream.
# The stream completion event wakes up the control flow, starting the application execution.
ret = acl.rt.synchronize_event(event)

# Explicitly destroy resources.
ret = acl.rt.destroy_stream(stream)
ret = acl.rt.destroy_event(event)
# ......