Function: start_thread
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Not supported
- Atlas inference products: Not supported
- Atlas training products: Supported
Function
Creates a thread and executes the Python function in the thread.
Prototype
thr_id, ret = acl.util.start_thread(thr_func, args_list)
Parameters
| Parameter | Description |
|---|---|
| thr_func | Python function object, indicating the user-defined Python function. An example is as follows. def thr_func(args_list): pass |
| args_list | List, indicating the input parameters required by the user-defined Python function (thr_func). |
Return Values
| Return Value | Description |
|---|---|
| thr_id | Int, thread ID. |
| ret | Int, error code.0: successIf other values are returned, the operation fails. |
Constraints
When a thread is created, the context cannot be automatically obtained. You need to call acl.rt.set_context to explicitly specify the context.