mirror of
https://gitee.com/moluo-tech/CodeBrick.git
synced 2025-02-06 04:48:22 +08:00
42 lines
1.4 KiB
C
42 lines
1.4 KiB
C
/******************************************************************************
|
||
* @brief <20>첽<EFBFBD><ECB2BD>ҵ
|
||
*
|
||
* Copyright (c) 2020, <master_roger@sina.com>
|
||
*
|
||
* SPDX-License-Identifier: Apache-2.0
|
||
*
|
||
* Change Logs:
|
||
* Date Author Notes
|
||
* 2020-09-22 Morro Initial version.
|
||
******************************************************************************/
|
||
#ifndef _ASYNC_WORK_H_
|
||
#define _ASYNC_WORK_H_
|
||
|
||
#include "qlink.h"
|
||
#include <stdbool.h>
|
||
|
||
/*<2A>첽<EFBFBD><ECB2BD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -------------------------------------------------------------*/
|
||
typedef struct {
|
||
struct qlink idle; /*<2A><><EFBFBD>ж<EFBFBD><D0B6><EFBFBD>*/
|
||
struct qlink ready; /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||
}async_work_t;
|
||
|
||
typedef void (*async_work_func_t)(async_work_t *w, void *object, void *params);
|
||
|
||
/*<2A>첽<EFBFBD><ECB2BD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD> ---------------------------------------------------------------*/
|
||
typedef struct {
|
||
void *object; /*<2A><>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>*/
|
||
void *params; /*<2A><>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>*/
|
||
async_work_func_t work; /*<2A><>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>*/
|
||
struct qlink_node node; /*<2A><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>*/
|
||
}work_node_t;
|
||
|
||
void async_work_init(async_work_t *w, work_node_t *nodes, int max_nodes);
|
||
|
||
bool async_work_add(async_work_t *w, void *object, void *params,
|
||
async_work_func_t work);
|
||
|
||
void async_work_process(async_work_t *w);
|
||
|
||
#endif
|