在多重速率 graph 中,所有内核都需要指向相同的迭代次数。在此类情况下,定时执行模型更适合用于测试。含正整数用于指定周期超时的 wait
和 end
API 具有多种变体。此数值表示在禁用处理器和布线之前,API 调用阻塞的 AI 引擎周期数。阻塞条件并非取决于任何 graph 终止事件。graph 可处于任意状态,超时即到期。
#include "project.h"
simpleGraph mygraph;
int main(void) {
mygraph.init();
mygraph.run();
mygraph.wait(10000); // wait for 10000 AI Engine cycles
mygraph.resume(); // continue executing
mygraph.end(15000); // wait for another 15000 cycles and terminate
}
注释: API
resume()
用于从首次超时后的停止点恢复执行。resume
仅用于复位定时器并启用 AI 引擎。在 AI 引擎执行已终止后调用 resume
是无效的。