HcommAclrtNotifyWaitOnThread
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
x |
√ |
|
√ |
|
x |
|
x |
|
x |
For
Function
Waits for a synchronization signal based on the Notify created by the ACL API. This API must be used in pair with HcommAclrtNotifyRecordOnThread.
Prototype
1 | int32_t HcommAclrtNotifyWaitOnThread(ThreadHandle thread, uint64_t notifyId, uint32_t timeOut) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
thread |
Input |
Thread handle, which is threads returned by the HcclThreadAcquire call. For details, see ThreadHandle. |
notifyId |
Input |
Synchronization signal ID, which is notifyId returned by the aclrtGetNotifyId call. |
timeOut |
Input |
Timeout interval, in milliseconds.
|
Returns
int32_t: 0 on success; else, failure.
Restrictions
None
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | HcclComm comm; CommEngine engine = COMM_ENGINE_CPU_TS; aclrtStream streams[2]; ThreadHandle threads[2]; // Allocate two streams, each with two Notify resources. aclrtCreateStream(&streams[0]); aclrtCreateStream(&streams[1]); HcclResult result = HcclThreadAcquireWithStream(comm, engine, streams[0], 2, &threads[0]); result = HcclThreadAcquireWithStream(comm, engine, streams[1], 2, &threads[1]); aclrtNotify notify; uint32_t notifyId; aclrtCreateNotify(&(notify), ACL_NOTIFY_DEFAULT); aclrtGetNotifyId(notify, &(notifyId)); // Send a synchronization signal. HcommAclrtNotifyRecordOnThread(threads[0], notifyId); // Wait for a synchronization signal. uint32_t timeout = 1; HcommAclrtNotifyWaitOnThread(threads[1], notifyId, timeout); |