---
title: 函数说明
description: "**表1 函数总览表**"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2300/accel/kunpengaccel_ksl_16_0049.html
sourcePath: /source/zh/kunpengboostkithistory/2300/accel/kunpengaccel_ksl_16_0049.html
indexId: 3cdaa584835e144de0fc6cf8adfa14f8985bdca52362e09b1c55ae9cef40426474
---
# 函数说明


**表1 函数总览表**

| 功能类型 | 函数名 | 函数功能 | 使用场景 |
| --- | --- | --- | --- |
| 初始化函数 | HTL\_initialize\_library | 初始化HTL。 | HTL\-OpenMP |
| 初始化函数 | HTL\_finalize\_library | 去初始化HTL。 | HTL\-OpenMP |
| 初始化函数 | HTL\_library\_initialized | 检查HTL是否初始化。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_create | 创建执行器。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_create\_basic | 创建基础执行器。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_free | 释放执行器。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_join | 等待执行器终止。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_set\_scheduler | 根据类型设置执行器的调度器。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_set\_scheduler\_basic | 设置执行器的调度器。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_run\_worker | 执行工作单元。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_check\_event | 处理与调度器关联的事件。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_self | 获取正在运行调用工作单元的执行器。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_self\_by\_rank | 获取与调用者关联的执行器等级。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_get\_num | 获取当前执行器的数量。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_set\_cpubind | 将执行器绑定到目标CPU。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_get\_cpubind | 获取执行器绑定的目标CPU。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_set\_affinity | 将执行器绑定到目标CPU列表上。 | HTL\-OpenMP |
| 执行器函数 | HTL\_thread\_executor\_get\_affinity | 获取执行器绑定的目标CPU列表。 | HTL\-OpenMP |
| 调度器函数 | HTL\_thread\_scheduler\_create | 创建调度器。 | HTL\-OpenMP |
| 调度器函数 | HTL\_thread\_scheduler\_create\_basic | 创建基础调度器。 | HTL\-OpenMP |
| 调度器函数 | HTL\_thread\_scheduler\_free | 释放调度器。 | HTL\-OpenMP |
| 调度器函数 | HTL\_thread\_scheduler\_get\_pool\_count | 获取调度器关联的池数。 | HTL\-OpenMP |
| 调度器函数 | HTL\_thread\_scheduler\_get\_pools | 获取与调度器关联的线程池。 | HTL\-OpenMP |
| 调度器函数 | HTL\_thread\_scheduler\_stop | 检查调度器是否需要停止。 | HTL\-OpenMP |
| 线程池函数 | HTL\_thread\_pool\_create | 创建线程池。 | HTL\-OpenMP |
| 线程池函数 | HTL\_thread\_pool\_pop | 从池中弹出工作单元。 | HTL\-OpenMP |
| 线程池函数 | HTL\_thread\_pool\_pop\_with\_context | 从池中按照context方式弹出工作单元。 | HTL\-OpenMP |
| 线程池函数 | HTL\_thread\_pool\_free | 释放线程池。 | HTL\-OpenMP |
| 线程池函数 | HTL\_worker\_associated\_with\_pool | 将工作单元与池关联。 | HTL\-OpenMP |
| 线程函数 | HLT\_thread\_create\_from\_pool | 在线程池上创建线程。 | HTL\-OpenMP |
| 线程函数 | HTL\_thread\_create | 创建线程。 | HTL\-PThreads |
| 线程函数 | HTL\_thread\_free | 释放线程。 | HTL\-OpenMP |
| 线程函数 | HTL\_thread\_join | 阻塞等待线程结束并获取返回值。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_join\_np | 阻塞等待线程结束。 | HTL\-OpenMP |
| 线程函数 | HTL\_thread\_exit | 终止线程并设置返回值。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_exit\_np | 终止线程。 | HTL\-OpenMP |
| 线程函数 | HTL\_thread\_cancel | 向线程发送取消指令。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_yield | 暂停当前线程，并将资源让给其他线程。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_revive | 唤醒被终止的线程。 | HTL\-OpenMP |
| 线程函数 | HTL\_thread\_equal | 比较两个线程是否相等。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_self | 返回线程句柄。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_set\_args | 设置线程参数。 | HTL\-OpenMP |
| 线程函数 | HTL\_thread\_get\_args | 获取线程参数。 | HTL\-OpenMP |
| 线程函数 | HTL\_thread\_setspecific | 设置线程私有变量的值。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_getspecific | 获取线程私有变量的值。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_atfork | 注册fork处理程序。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_getthreadid\_np | 获取当前线程的ID。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_setaffinity\_np | 设置线程亲和性。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_getaffinity\_np | 获取线程亲和性。 | HTL\-OpenMP，HTL\-PThreads |
| 线程函数 | HTL\_thread\_mach\_thread\_np | 获取指定线程的ID。 | HTL\-OpenMP，HTL\-PThreads |
| 线程属性函数 | HTL\_thread\_attr\_init | 初始化线程属性。 | HTL\-OpenMP，HTL\-PThreads |
| 线程属性函数 | HTL\_thread\_attr\_destroy | 销毁线程属性。 | HTL\-OpenMP，HTL\-PThreads |
| 线程属性函数 | HTL\_thread\_attr\_setstack | 指定内存设置线程属性中的栈大小。 | HTL\-OpenMP，HTL\-PThreads |
| 线程属性函数 | HTL\_thread\_attr\_getstack | 指定内存获取线程属性中的栈大小。 | HTL\-OpenMP，HTL\-PThreads |
| 线程属性函数 | HTL\_thread\_attr\_setstacksize | 设置线程属性中的栈大小。 | HTL\-OpenMP，HTL\-PThreads |
| 线程属性函数 | HTL\_thread\_attr\_getstacksize | 获取线程属性中的栈大小。 | HTL\-OpenMP，HTL\-PThreads |
| 线程属性函数 | HTL\_thread\_get\_attr | 获取线程属性。 | HTL\-OpenMP，HTL\-PThreads |
| 互斥锁函数 | HTL\_thread\_mutex\_init | 初始化互斥锁。 | HTL\-OpenMP，HTL\-PThreads |
| 互斥锁函数 | HTL\_thread\_mutex\_destroy | 销毁互斥锁。 | HTL\-OpenMP，HTL\-PThreads |
| 互斥锁函数 | HTL\_thread\_mutex\_lock | 锁定互斥锁。 | HTL\-OpenMP，HTL\-PThreads |
| 互斥锁函数 | HTL\_thread\_mutex\_trylock | 尝试锁定互斥锁。 | HTL\-OpenMP，HTL\-PThreads |
| 互斥锁函数 | HTL\_thread\_mutex\_unlock | 解锁互斥锁。 | HTL\-OpenMP，HTL\-PThreads |
| 互斥锁属性函数 | HTL\_thread\_mutexattr\_init | 初始化互斥锁属性。 | HTL\-OpenMP，HTL\-PThreads |
| 互斥锁属性函数 | HTL\_thread\_mutexattr\_destroy | 销毁互斥锁属性。 | HTL\-OpenMP，HTL\-PThreads |
| 互斥锁属性函数 | HTL\_thread\_mutexattr\_settype | 设置互斥锁属性。 | HTL\-OpenMP，HTL\-PThreads |
| 条件变量函数 | HTL\_thread\_cond\_init | 初始化条件变量。 | HTL\-OpenMP，HTL\-PThreads |
| 条件变量函数 | HTL\_thread\_cond\_destroy | 销毁条件变量。 | HTL\-OpenMP，HTL\-PThreads |
| 条件变量函数 | HTL\_thread\_cond\_wait | 等待条件变量信号。 | HTL\-OpenMP，HTL\-PThreads |
| 条件变量函数 | HTL\_thread\_cond\_timedwait | 等待条件变量信号并设置超时时间。 | HTL\-OpenMP，HTL\-PThreads |
| 条件变量函数 | HTL\_thread\_cond\_signal | 发送条件变量的信号给一个等待线程。 | HTL\-OpenMP，HTL\-PThreads |
| 条件变量函数 | HTL\_thread\_cond\_broadcast | 发送条件变量的信号给所有等待的线程。 | HTL\-OpenMP，HTL\-PThreads |
| 屏障函数 | HTL\_thread\_barrier\_init | 初始化屏障。 | HTL\-OpenMP，HTL\-PThreads |
| 屏障函数 | HTL\_thread\_barrier\_reinit | 重新初始化屏障。 | HTL\-OpenMP |
| 屏障函数 | HTL\_thread\_barrier\_destroy | 销毁屏障。 | HTL\-OpenMP，HTL\-PThreads |
| 屏障函数 | HTL\_thread\_barrier\_wait | 等待所有线程到达屏障。 | HTL\-OpenMP，HTL\-PThreads |
| 读写锁函数 | HTL\_thread\_rwlock\_init | 初始化读写锁。 | HTL\-OpenMP，HTL\-PThreads |
| 读写锁函数 | HTL\_thread\_rwlock\_destroy | 销毁读写锁。 | HTL\-OpenMP，HTL\-PThreads |
| 读写锁函数 | HTL\_thread\_rwlock\_rdlock | 读锁定读写锁。 | HTL\-OpenMP，HTL\-PThreads |
| 读写锁函数 | HTL\_thread\_rwlock\_wrlock | 写锁定读写锁。 | HTL\-OpenMP，HTL\-PThreads |
| 读写锁函数 | HTL\_thread\_rwlock\_unlock | 释放读写锁。 | HTL\-OpenMP，HTL\-PThreads |
| 私有变量函数 | HTL\_thread\_key\_create | 创建线程私有变量。 | HTL\-OpenMP，HTL\-PThreads |
| 私有变量函数 | HTL\_thread\_key\_delete | 释放线程私有变量。 | HTL\-OpenMP，HTL\-PThreads |
| 扩展特性函数 | HTL\_create\_randws\_numa\_resource | 创建randws\_numa资源。 | HTL\-OpenMP |
| 扩展特性函数 | HTL\_destroy\_randws\_numa\_resource | 销毁randws\_numa资源。 | HTL\-OpenMP |
| 扩展特性函数 | HTL\_get\_pool\_for\_thread\_from\_numa\_pools | 获取randws\_numa中的线程池。 | HTL\-OpenMP |
| 扩展特性函数 | HTL\_is\_cpu\_in\_same\_numa | 判断CPU是否属于同一个NUMA。 | HTL\-OpenMP |
