TuyaOS
结构体 | 类型定义 | 枚举 | 函数
tal_workqueue.h 文件参考

tuya workqueue module 更多...

#include "tuya_cloud_types.h"
#include "tal_thread.h"
tal_workqueue.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

结构体

struct  WORK_ITEM_T
 

类型定义

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

函数说明

◆ tal_workqueue_cancel()

OPERATE_RET tal_workqueue_cancel ( WORKQUEUE_HANDLE  handle,
WORKQUEUE_CB  cb,
VOID_T *  data 
)

cancel work task in workqueue

参数
[in]handlethe workqueue handle
[in]cbthe work callback
[in]datathe 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_workhandle 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_lenthe maximum number of items that the workqueue can contain
[in]thread_cfgthread param
[out]handlethe 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]handlethe 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]handlethe 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]handlethe workqueue handle
[in]cbthe work callback
[in]datathe work data
[out]delayed_workhandle 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]handlethe 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]handlethe workqueue handle
[in]cbthe work callback
[in]datathe 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]handlethe workqueue handle
[in]cbthe work callback
[in]datathe 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_workhandle of delayed work
[in]intervalnumber of ms to wait or 0 for immediate execution
[in]typesee @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_workhandle 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]handlethe workqueue handle
[in]cbthe traverse callback
[in]ctxthe traverse context
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h