!9531 [taskpool] add interface for LongTask

Merge pull request !9531 from huangfeijie/taskpool_interface
This commit is contained in:
openharmony_ci 2024-03-30 09:44:01 +00:00 committed by Gitee
commit f3a083816e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -559,6 +559,18 @@ declare namespace taskpool {
execute(task: Task): Promise<Object>;
}
/**
* The LongTask class provides an interface to create a task that has no upper limit on execution time.
*
* @extends Task
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
class LongTask extends Task {
}
/**
* The State defines the task state.
*
@ -1054,6 +1066,18 @@ declare namespace taskpool {
* @since 11
*/
function getTaskPoolInfo(): TaskPoolInfo;
/**
* Terminate a long task.
*
* @param { LongTask } longTask - The long task want to terminate.
* @throws { BusinessError } 401 - The input parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
function terminateTask(longTask: LongTask): void;
}
export default taskpool;