使用步骤:
1、INIT_DELAYED_WORK(&host->detect, mmc_rescan);
struct delayed_work {//&host->detect 的定义就是delayed_work
struct work_struct work = {
atomic_long_t data; //WORK_DATA_INIT
struct list_head entry; //INIT_LIST_HEAD(&(_work)->entry);
work_func_t func; //mmc_rescan
};
struct timer_list timer; //__setup_timer(&timer, delayed_work_timer_fn,(unsigned long)(delayed_work),
/* target workqueue and CPU ->timer uses to queue ->work */
struct workqueue_struct *wq;
int cpu;
};
2、queue_delayed_work(workqueue, work, delay);
阅读(4768) | 评论(0) | 转发(0) |