Re: another poll-method waitq question

From: Capstar (spam0_at_deleg.homeip.net)
Date: 02/12/04


Date: Thu, 12 Feb 2004 13:25:27 +0100

Capstar wrote:
> Now I understand (at least I think I do) how do_select and poll work I'm
> left with one little question. How does it work when for instance the
> ability to read is determined by reading from a register on a device,
> and the wakeup is called from a ISR? If I read the register and I
> determine a read will block, I don;t return the right bit mask so
> do_select will schedule_timeout. But if in between the wait_poll() call
> and the schedule_timeout() the interrupt occurs, which would result in
> the ISR to call wake_up_interruptible(), the queue is woken up before we
> slept on it. That would result in a timeout or deadlock when not timeout
> is specified.
>
> Am I correct here? And if so, how can I solve this?
>
> Mark
>

Hmmm, this is getting anoying, but again I got an idea right after
posting. :)

What if I first do poll_wait() (not wait_poll() as posted previously),
and then do the check. I guess the ttate would be set to TASK_RUNNING
again by the wake_up_interruptible, and schedule_timeout() might
schedule the process out, but it will also be scheduled back again.
I know the state is set to TASK_INTERRUPTIBLE before de drivers
poll-method is called. So this should/might work.

Please confirm :)

Mark

-- 
<<Remove the del for email>>


Relevant Pages