Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by Peter for How to create a kernel thread in atomic context and use it multiple times [BUG: Scheduling while atomic]

You don't actually want a kernel thread. You want a workqueue. You can queue a worker function from your interrupt top-half, and the kernel will run it in process context as soon as it has time. If you can avoid sleeping, you can use the shared queue via the functions schedule_work() and schedule_delayed_work().

To avoid sleeping, queue one work function to turn on the LED. At the end of that function, queue a delayed work function to turn it off.

If you instead want to do a simple TURN_ON(); sleep(); TURN_OFF(), you'll need to create your own workqueue at module init, and submit to that using queue_work() and queue_delayed_work()

Reference:http://www.makelinux.net/ldd3/chp-7-sect-6


Viewing latest article 1
Browse Latest Browse All 2

Trending Articles