# Common Object When a common object is transferred across threads, the object content of the two threads is the same, but the object points to the isolated memory area of each thread. For example, objects such as Object, Array, and Map defined in the Ecmascript262 specification implement cross-concurrent instance communication in this manner. The following figure shows the communication process. ![deep_copy](figures/deep_copy.png) ## Samples A simple example of transferring a common object is provided here. The implementation is as follows: ```ts // Test.ets // Customize class TestA. export class TestA { constructor(name: string) { this.name = name; } name: string = 'ClassA'; } ``` ```ts // Index.ets import { taskpool } from '@kit.ArkTS'; import { BusinessError } from '@kit.BasicServicesKit'; import { TestA } from './Test'; @Concurrent async function test1(arg: TestA) { console.info("TestA name is: " + arg.name); } @Entry @Component struct Index { @State message: string = 'Hello World'; build() { RelativeContainer() { Text(this.message) .id('HelloWorld') .fontSize(50) .fontWeight(FontWeight.Bold) .alignRules({ center: { anchor: '__container__', align: VerticalAlign.Center }, middle: { anchor: '__container__', align: HorizontalAlign.Center } }) .onClick(() => { // 1. Create a test instance objA. let objA = new TestA("TestA"); // 2. Create a task and transfer objA to the task. objA is not a sendable object and is transferred to the subthread through serialization. let task = new taskpool.Task(test1, objA); 3. Execute the task. taskpool.execute(task).then(() => { console.info("taskpool: execute task success!"); }).catch((e:BusinessError) => { console.error(`taskpool: execute task: Code: ${e.code}, message: ${e.message}`); }) }) } .height('100%') .width('100%') } } ```