TuyaOS
tal_thread.h
1
12#ifndef __TAL_THREAD_H__
13#define __TAL_THREAD_H__
14
15#include "tuya_cloud_types.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21typedef VOID_T* THREAD_HANDLE;
22
27#define TAL_THREAD_MAX_NAME_LEN 16
28
33typedef VOID (*THREAD_FUNC_CB)(PVOID_T args);
38typedef VOID(*THREAD_ENTER_CB)(VOID);
39
44typedef VOID(*THREAD_EXIT_CB)(VOID); // thread extract
49typedef enum {
50 THREAD_STATE_EMPTY = 0,
51 THREAD_STATE_RUNNING,
52 THREAD_STATE_STOP,
53 THREAD_STATE_DELETE,
54} THREAD_STATE_E;
55
60typedef enum {
61 THREAD_PRIO_0 = 5,
62 THREAD_PRIO_1 = 4,
63 THREAD_PRIO_2 = 3,
64 THREAD_PRIO_3 = 2,
65 THREAD_PRIO_4 = 1,
66 THREAD_PRIO_5 = 0,
67 THREAD_PRIO_6 = 0,
68} THREAD_PRIO_E;
73typedef struct {
74 UINT_T stackDepth; // stack size
75 UINT8_T priority; // thread priority
76 CHAR_T *thrdname; // thread name
78
90OPERATE_RET tal_thread_create_and_start(THREAD_HANDLE *handle,
91 CONST THREAD_ENTER_CB enter,
92 CONST THREAD_EXIT_CB exit,
93 CONST THREAD_FUNC_CB func,
94 CONST PVOID_T func_args,
95 CONST THREAD_CFG_T *cfg);
102OPERATE_RET tal_thread_delete(CONST THREAD_HANDLE handle);
103
111OPERATE_RET tal_thread_is_self(CONST THREAD_HANDLE handle, BOOL_T *bl);
112
119THREAD_STATE_E tal_thread_get_state(CONST THREAD_HANDLE handle);
120
127OPERATE_RET tal_thread_diagnose(CONST THREAD_HANDLE handle);
128#ifdef __cplusplus
129}
130#endif /* __cplusplus */
131
132#endif
133
thread parameters
Definition: tal_thread.h:73