Messages in this thread | | | Subject | Re: poll() in 2.6 and beyond | From | Dave Dillow <> | Date | Tue, 02 Mar 2004 17:41:18 -0500 |
| |
On Tue, 2004-03-02 at 16:59, Richard B. Johnson wrote: > On Tue, 2 Mar 2004, Roland Dreier wrote:
> > I don't know why I continue this, but.... can you point out the line > > in the kernel 2.4 source for __pollwait() where it sleeps?
> The code in fs/select.c about line 101, adds the current caller > to the wait-queue. This wait-queue is the mechanism by which the > current caller sleeps, i.e., gives the CPU up to somebody else.
Actually, no, it does not work that way. The wait queue is the mechanism by which a process can be *woken up* . The call to add_wait_queue() does not put the process to sleep.
The process is put to sleep in do_poll(), using schedule_timeout() with the current state as TASK_INTERRUPTIBLE. This is on line 453.
Your driver will eventually have to wake up sleepers on the queue. do_poll() will also wake up when the timeout expires, or a signal is sent to the poll()'ing process.
These semantics have not changed since 2.4. The implementation has changed a bit, but the driver interface has not changed. Read the documentation the Roland pointed you to. -- Dave Dillow <dave@thedillows.org>
- 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/
| |