mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 10:15:57 +01:00
Move sleep and workqueue module doc to README
sleep was broken because the workqueue was declared locally inside init, further evidence that no one has ever run the examples :-(
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
/*
|
||||
Declare more work from a workqueue.
|
||||
*/
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#workqueue-from-workqueue */
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
static int i = 0;
|
||||
static int i;
|
||||
static struct workqueue_struct *queue;
|
||||
|
||||
static void work_func(struct work_struct *work);
|
||||
@@ -18,6 +16,8 @@ static void work_func(struct work_struct *work)
|
||||
{
|
||||
pr_info("%d\n", i);
|
||||
i++;
|
||||
if (i == 10)
|
||||
i = 0;
|
||||
queue_delayed_work(queue, &next_work, HZ);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user