未验证 提交 3a2c161e 编写于 作者: O openharmony_ci 提交者: Gitee

!7970 add xts for taskpool.execute(task, priority)

Merge pull request !7970 from cwx1148594/OpenHarmony-3.2-Release
......@@ -908,6 +908,23 @@ describe('ActsAbilityTest', function () {
done();
})
it('TaskPoolTestClass061', 0, async function (done) {
function Sum(value1, value2) {
"use concurrent"
return value1 + value2;
}
var task1 = new taskpool.Task(Sum, 10, 20);
var task2 = new taskpool.Task(Sum, 30, 40);
var task3 = new taskpool.Task(Sum, 50, 60);
var result1 = await taskpool.execute(task1,taskpool.Priority.LOW);
var result2 = await taskpool.execute(task2,taskpool.Priority.HIGH);
var result3 = await taskpool.execute(task3,taskpool.Priority.MEDIUM);
expect(result1).assertEqual(30);
expect(result2).assertEqual(70);
expect(result3).assertEqual(110);
done();
})
/**
* @tc.number : TaskPoolTestClass049
* @tc.name : Async Function Cancel task
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册