工作队列work_struct,delayed_work的使用
- 工作队列,work_struct
1、定义
static struct work_struct work;
static void work_callback_func(struct work_struct *work)
{
}
2、初始化
INIT_WORK(&work, work_callback_func);
3、触发工作队列
schedule_work(&work);
- 延时工作队列,delayed_work
1、定义
static struct delayed_work delayed_work;
static void delayed_callback_func(struct work_struct *work)
{
}
2、初始化
INIT_DELAYED_WORK(&delayed_work, delayed_callback_func);
3、触发延时工作队列
schedule_delayed_work(&delayed_work, 5 * HZ);