Wait
Product Support
Product |
Supported |
|---|---|
x |
|
√ |
|
x |
|
x |
|
x |
|
x |
Function
Checks whether a message has been processed by the AIC after PostMessage or PostFakeMessage is called.
Prototype
1 2 | template <bool sync = true> __aicore__ inline bool Wait(uint16_t offset) |
Parameters
Parameter |
Description |
|---|---|
sync |
Whether the program needs to wait when messages are queried. Values:
|
Parameter |
Input/Output |
Description |
|---|---|---|
offset |
Input |
Offset of the message space address, which is obtained from the return of PostMessage or PostFakeMessage. |
Returns
- true: The current message has been processed by the AIC.
- false: The current message has not been fully processed by AIC.
Restrictions
None
Example
1 2 3 4 5 6 7 8 9 | auto msgPtr = handle.AllocMessage(); // A new message can be sent at the location pointed to by msgPtr. AscendC::CubeGroupMsgHead headA = {AscendC::CubeMsgState::VALID, 0}; AscendC::CubeMsgBody msgA = {headA, 1, 0, 0, false, false, false, false, 0, 0, 0, 0, 0, 0, 0, 0}; auto offset = handle.PostMessage(msgPtr, msgA); // Fill the custom message structure at the location pointed to by msgPtr and send the message. bool waitState = handle.template Wait<true>(offset); // Wait for the AIC to finish processing msgA. // Fake message scenario auto msgFakePtr = handle.AllocMessage(); offset = handle.PostFakeMsg(msgFakePtr); bool waitState = handle.template Wait<true>(offset); // Wait for the AIC to finish processing msgFake. |
Parent topic: CubeResGroupHandle