1# \@Concurrent Decorator: Verifying Concurrent Functions 2 3To pass function verification, the concurrent functions executed in a [TaskPool](../reference/apis/js-apis-taskpool.md) must be decorated using \@Concurrent. 4 5 6> **NOTE** 7> 8> Since API version 9, this decorator is supported in ArkTS widgets. 9 10 11## Decorator Description 12| \@Concurrent Decorator| Description | 13| --------------------- | ------------------------------------------------------------------------------------------ | 14| Decorator parameters | None. | 15| Application scenarios | This decorator can be used only in projects of the stage model. | 16| Decorated function types | This decorator can be used for asynchronous functions and common functions. It cannot be used for generators, arrow functions, or methods. It does not support class member functions or anonymous functions. | 17| Variable types in decorated functions | Local variables, input parameters, and variables imported through **import** are supported. Closure variables are not allowed. | 18 19 20## Example 21 ```ts 22 import taskpool from '@ohos.taskpool'; 23 24 @Concurrent 25 function add(num1: number, num2: number): number { 26 return num1 + num2; 27 } 28 29 async function ConcurrentFunc(): Promise<void> { 30 try { 31 let task: taskpool.Task = new taskpool.Task(add, 1, 2); 32 console.info("taskpool res is: " + await taskpool.execute(task)); 33 } catch (e) { 34 console.error("taskpool execute error is: " + e); 35 } 36 } 37 38 @Entry 39 @Component 40 struct Index { 41 @State message: string = 'Hello World' 42 43 build() { 44 Row() { 45 Column() { 46 Text(this.message) 47 .fontSize(50) 48 .fontWeight(FontWeight.Bold) 49 .onClick(() => { 50 ConcurrentFunc(); 51 }) 52 } 53 .width('100%') 54 } 55 .height('100%') 56 } 57 } 58 ``` 59