Messages in this thread | ![/](/images/icornerl.gif) | | Date | Tue, 1 Apr 2003 12:00:16 -0500 (EST) | From | "Richard B. Johnson" <> | Subject | Re: Regarding task queues |
| |
On Tue, 1 Apr 2003, David Anderson wrote:
> 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.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |