函数:start_thread
产品支持情况
- Ascend 950PR&950DT系列产品:支持
- Atlas A3系列产品:支持
- Atlas A2系列产品:支持
- Atlas 200I/500 A2推理产品:不支持
- Atlas推理系列产品:不支持
- Atlas训练系列产品:支持
功能说明
创建线程,在线程中执行传入的Python函数。
函数原型
thr_id, ret = acl.util.start_thread(thr_func, args_list)
参数说明
| 参数名 | 说明 |
|---|---|
| thr_func | Python函数对象,表示用户自定义的Python函数。 例如: def thr_func(args_list): pass |
| args_list | list,表示用户自定义的Python函数(thr_func)需要的传入参数。 |
返回值说明
| 返回值 | 说明 |
|---|---|
| thr_id | int,线程ID号。 |
| ret | int,错误码,0表示线程创建成功,其他值为线程创建失败时返回的POSIX错误号。 |
约束说明
新建线程,无法自动获取Context,需要调用acl.rt.set_context接口显式指定Context。