Regarding task queues
Hi,
Is it possible for a task, run from a schedule task queue(tq_schedule) to sleep / block ?? Can tasks be queued to this queue from a interrupt context ??
Thanks and Regards,
David Anderson
Signature · 3 lines
__________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup
Quoted 6 lines · David Anderson
Hi,
Is it possible for a task, run from a schedule task
queue(tq_schedule)to sleep / block ?? Can tasks be queued to this queue from a interrupt context ??
All tasks that are queued can sleep. However you cannot ever sleep or schedule, etc., in interrupt context. Not to worry, though, you can wake up any tasks from interrupt context and, of course, you can set up any pointers, etc., in the interrupt.
So, you can make a kernel thread. This is a fully-functioning task that runs in kernel space. It can sleep "interruptible_ sleep_on()", when it is sleeping, your interrupt can give it something to do, then wake it up "wake_up_interruptible()". The interrupt continues as a normal interrupt and, after it completes, the kernel will awaken your task to do whatever you told it to do. FYI, you can "tell it to do many things" by changing a pointer to some procedure. That pointer can, of course, be changed in interrupt context. You just make sure that your kernel thread is sleeping and isn't going to be awakened while your pointer is being changed (possible in a SMP machine, you may need a spin-lock).
This is a real easy way to do kernel-space processing based upon some interrupt. There are other ways, too.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it.