---
title: HTL_thread_scheduler_create_basic
description: "创建基础调度器。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/251RC1/accel/kunpengaccel_ksl_16_0072.html
sourcePath: /source/zh/kunpengboostkithistory/251RC1/accel/kunpengaccel_ksl_16_0072.html
indexId: 8c95ef75178de54358bd0e7cc7b44a6830cb9dd742db417cdca50f8a9510293276
---
# HTL_thread_scheduler_create_basic

创建基础调度器。

#### 接口定义

int HTL_thread_scheduler_create_basic(HTL_thread_scheduler_type_t sched_type, int num_thread_pools, HTL_thread_pool_t *thread_pools, HTL_thread_scheduler_config_t sched_config, HTL_thread_scheduler_t *scheduler);


#### 描述

HTL_thread_scheduler_create_basic()会创建一个由HTL定义的基础调度器，通过调度器类型sched_type和调度器配置sched_config决定，并通过scheduler返回调度器句柄。

调度器scheduler与线程池thread_pools数组关联，数组包含num_thread_pools个HTL_thread_pool_t句柄。如果thread_pools第i个元素是HTL_THREAD_POOL_NULL，则新建具有默认池配置的默认FIFO池，并将其用作第i个。


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| sched\_type | HTL\_thread\_scheduler\_type\_t | 调度器类型。 | 输入 |
| num\_thread\_pools | int | 与此调度器关联的池数。 | 输入 |
| thread\_pools | HTL\_thread\_pool\_t \* | 与此调度器关联的池。 | 输入 |
| sched\_config | HTL\_thread\_scheduler\_config\_t | 用于创建调度器的调度器配置。 | 输入 |
| scheduler | HTL\_thread\_scheduler\_t \* | 调度器句柄地址。 | 输出 |


#### 返回值

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


#### 示例

```
HTL_thread_scheduler_t sched;
    ret = HTL_thread_scheduler_create_basic(HTL_THREAD_SCHEDULER_DEFAULT, 1, &pool,
                                            HTL_THREAD_SCHEDULER_CONFIG_NULL, &sched);
```
