---
title: HTL_thread_attr_init
description: "初始化线程属性。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2300/accel/kunpengaccel_ksl_16_0106.html
sourcePath: /source/zh/kunpengboostkithistory/2300/accel/kunpengaccel_ksl_16_0106.html
indexId: 7e38cc2d8f67fbc58cd8fc5f79a57235ee5d7e22b1ada40f0066ace36c7f5cba74
---
# HTL_thread_attr_init

初始化线程属性。

#### 接口定义

int HTL_thread_attr_init(HTL_thread_attr_t *thread_attr);


#### 描述

HTL_thread_attr_init()使用默认属性参数初始化线程属性，并通过thread_attr返回其句柄。

默认线程属性参数如下：

- 如果启用了内存池，则使用内存池进行堆栈分配。
- 默认栈大小，可通过环境HTL_THREAD_STACKSIZE设置。
- 可迁移。
- 迁移时不调用回调函数。

线程属性thread_attr在使用后需通过函数HTL_thread_attr_destroy()销毁。


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| thread\_attr | HTL\_thread\_attr\_t \* | 线程属性句柄的地址。 | 输出 |


#### 返回值

- HTL_THREAD_SUCCESS：成功。
- 其他：失败。见错误码定义。


#### 示例

```
HTL_thread_attr_t attr;
/* ULT attribute */
ret = HTL_thread_attr_init(&attr);
```
