execute<R, P> method
void
execute<R, P>({
- required FutureOr<
R> doWork(- P argument
- dynamic call(
- R response
- required P argument,
执行多线程微任务
doWork
耗时任务
call
耗时任务执行结果回调
argument
任务执行传入参数
Implementation
void execute<R, P>(
{required FutureOr<R> Function(P argument) doWork, Function(R response)? call, required P argument}) {
loadBalancer.then((balancer) {
balancer.run<R, P>(doWork, argument).then((response) {
if (call != null) {
call(response);
}
});
});
}