* @brief Initialize a work item, binding with a callback function. * * @param work is a pointer to the work item object. * * @param work_func is a callback function that will be called when this work item is executed. * * @param work_data is a user data passed to the callback function as the second parameter. */
| 189 | * @param work_data is a user data passed to the callback function as the second parameter. |
| 190 | */ |
| 191 | void rt_work_init(struct rt_work *work, |
| 192 | void (*work_func)(struct rt_work *work, void *work_data), |
| 193 | void *work_data) |
| 194 | { |
| 195 | RT_ASSERT(work != RT_NULL); |
| 196 | RT_ASSERT(work_func != RT_NULL); |
| 197 | |
| 198 | rt_list_init(&(work->list)); |
| 199 | work->work_func = work_func; |
| 200 | work->work_data = work_data; |
| 201 | work->workqueue = RT_NULL; |
| 202 | work->flags = 0; |
| 203 | work->type = 0; |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * @brief Create a work queue with a thread inside. |
no test coverage detected