tuya workqueue module
更多...
#include "tuya_cloud_types.h"
#include "tal_thread.h"
浏览源代码.
|
typedef VOID_T * | DELAYED_WORK_HANDLE |
|
typedef VOID_T(* | WORKQUEUE_CB) (VOID_T *data) |
|
typedef VOID_T * | WORKQUEUE_HANDLE |
|
typedef BOOL_T(* | WORKQUEUE_TRAVERSE_CB) (WORK_ITEM_T *item, VOID_T *ctx) |
|
|
enum | LOOP_TYPE { LOOP_ONCE
, LOOP_CYCLE
} |
|
|
OPERATE_RET | tal_workqueue_cancel (WORKQUEUE_HANDLE handle, WORKQUEUE_CB cb, VOID_T *data) |
| cancel work task in workqueue 更多...
|
|
OPERATE_RET | tal_workqueue_cancel_delayed (DELAYED_WORK_HANDLE delayed_work) |
| cancel delayed work 更多...
|
|
OPERATE_RET | tal_workqueue_create (CONST UINT16_T queue_len, THREAD_CFG_T *thread_cfg, WORKQUEUE_HANDLE *handle) |
| create and initialize a workqueue which runs in thread context 更多...
|
|
UINT16_T | tal_workqueue_get_num (WORKQUEUE_HANDLE handle) |
| get the workqueue item number 更多...
|
|
THREAD_HANDLE | tal_workqueue_get_thread (WORKQUEUE_HANDLE handle) |
| get thread handle of the workqueue 更多...
|
|
OPERATE_RET | tal_workqueue_init_delayed (WORKQUEUE_HANDLE handle, WORKQUEUE_CB cb, VOID_T *data, DELAYED_WORK_HANDLE *delayed_work) |
| init delayed work in workqueue 更多...
|
|
OPERATE_RET | tal_workqueue_release (WORKQUEUE_HANDLE handle) |
| release the workqueue 更多...
|
|
OPERATE_RET | tal_workqueue_schedule (WORKQUEUE_HANDLE handle, WORKQUEUE_CB cb, VOID_T *data) |
| put work task in workqueue 更多...
|
|
OPERATE_RET | tal_workqueue_schedule_instant (WORKQUEUE_HANDLE handle, WORKQUEUE_CB cb, VOID_T *data) |
| put work task in workqueue, instant will be dequeued first 更多...
|
|
OPERATE_RET | tal_workqueue_start_delayed (DELAYED_WORK_HANDLE delayed_work, TIME_MS interval, LOOP_TYPE type) |
| put work in workqueue after delay 更多...
|
|
OPERATE_RET | tal_workqueue_stop_delayed (DELAYED_WORK_HANDLE delayed_work) |
| stop delayed work 更多...
|
|
OPERATE_RET | tal_workqueue_traverse (WORKQUEUE_HANDLE handle, WORKQUEUE_TRAVERSE_CB cb, VOID_T *ctx) |
| traverse the queue with specific callback 更多...
|
|
tuya workqueue module
- 版本
- 1.0
- 日期
- 2019-10-30
- 版权所有
- Copyright 2021-2031 Tuya Inc. All Rights Reserved.
◆ tal_workqueue_cancel()
OPERATE_RET tal_workqueue_cancel |
( |
WORKQUEUE_HANDLE |
handle, |
|
|
WORKQUEUE_CB |
cb, |
|
|
VOID_T * |
data |
|
) |
| |
cancel work task in workqueue
- 参数
-
[in] | handle | the workqueue handle |
[in] | cb | the work callback |
[in] | data | the work data |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tal_workqueue_cancel_delayed()
OPERATE_RET tal_workqueue_cancel_delayed |
( |
DELAYED_WORK_HANDLE |
delayed_work | ) |
|
cancel delayed work
- 参数
-
[in] | delayed_work | handle of delayed work |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tal_workqueue_create()
OPERATE_RET tal_workqueue_create |
( |
CONST UINT16_T |
queue_len, |
|
|
THREAD_CFG_T * |
thread_cfg, |
|
|
WORKQUEUE_HANDLE * |
handle |
|
) |
| |
create and initialize a workqueue which runs in thread context
- 参数
-
[in] | queue_len | the maximum number of items that the workqueue can contain |
[in] | thread_cfg | thread param |
[out] | handle | the workqueue handle |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tal_workqueue_get_num()
UINT16_T tal_workqueue_get_num |
( |
WORKQUEUE_HANDLE |
handle | ) |
|
get the workqueue item number
- 参数
-
[in] | handle | the workqueue handle |
- 返回
- the current item counts
◆ tal_workqueue_get_thread()
THREAD_HANDLE tal_workqueue_get_thread |
( |
WORKQUEUE_HANDLE |
handle | ) |
|
get thread handle of the workqueue
- 参数
-
[in] | handle | the workqueue handle |
- 返回
- thread handle
◆ tal_workqueue_init_delayed()
OPERATE_RET tal_workqueue_init_delayed |
( |
WORKQUEUE_HANDLE |
handle, |
|
|
WORKQUEUE_CB |
cb, |
|
|
VOID_T * |
data, |
|
|
DELAYED_WORK_HANDLE * |
delayed_work |
|
) |
| |
init delayed work in workqueue
- 参数
-
[in] | handle | the workqueue handle |
[in] | cb | the work callback |
[in] | data | the work data |
[out] | delayed_work | handle of delayed work |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tal_workqueue_release()
OPERATE_RET tal_workqueue_release |
( |
WORKQUEUE_HANDLE |
handle | ) |
|
release the workqueue
- 参数
-
[in] | handle | the workqueue handle |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tal_workqueue_schedule()
OPERATE_RET tal_workqueue_schedule |
( |
WORKQUEUE_HANDLE |
handle, |
|
|
WORKQUEUE_CB |
cb, |
|
|
VOID_T * |
data |
|
) |
| |
put work task in workqueue
- 参数
-
[in] | handle | the workqueue handle |
[in] | cb | the work callback |
[in] | data | the work data |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tal_workqueue_schedule_instant()
OPERATE_RET tal_workqueue_schedule_instant |
( |
WORKQUEUE_HANDLE |
handle, |
|
|
WORKQUEUE_CB |
cb, |
|
|
VOID_T * |
data |
|
) |
| |
put work task in workqueue, instant will be dequeued first
- 参数
-
[in] | handle | the workqueue handle |
[in] | cb | the work callback |
[in] | data | the work data |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tal_workqueue_start_delayed()
OPERATE_RET tal_workqueue_start_delayed |
( |
DELAYED_WORK_HANDLE |
delayed_work, |
|
|
TIME_MS |
interval, |
|
|
LOOP_TYPE |
type |
|
) |
| |
put work in workqueue after delay
- 参数
-
[in] | delayed_work | handle of delayed work |
[in] | interval | number of ms to wait or 0 for immediate execution |
[in] | type | see @LOOP_TYPE |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tal_workqueue_stop_delayed()
OPERATE_RET tal_workqueue_stop_delayed |
( |
DELAYED_WORK_HANDLE |
delayed_work | ) |
|
stop delayed work
- 参数
-
[in] | delayed_work | handle of delayed work |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h
◆ tal_workqueue_traverse()
OPERATE_RET tal_workqueue_traverse |
( |
WORKQUEUE_HANDLE |
handle, |
|
|
WORKQUEUE_TRAVERSE_CB |
cb, |
|
|
VOID_T * |
ctx |
|
) |
| |
traverse the queue with specific callback
- 参数
-
[in] | handle | the workqueue handle |
[in] | cb | the traverse callback |
[in] | ctx | the traverse context |
- 返回
- OPRT_OK on success. Others on error, please refer to tuya_error_code.h