Re: Problems writting a CHAR Driver with interruptible_sleep (wait

Raul Dias (chaos@swi.com.br)
Thu, 12 Aug 1999 17:36:56 -0300 (EST)


On 12 Aug, thomas.putnam@natinst.com wrote:
> A quick solution is to turn off interrupts with a cli() immediately before you
> tell the device that you want them. When you call interuptible_sleep, Linux
> will enable interrupts after you are safely in the wait queue, and any pending
> interrupts will occur.

I just did that, and it really improved the response :-)

But as you said below, it eventually loses the interrupt call and stays
sleeping until "^C" (using an cat /dev/chaos).

> To avoid losing interrupts, however, you might want
> implement some kind of queue to hold messages. You would still use a cli() to
> make sure everything happened atomically, however. The correct implementation
> really depends on how your device functions.

Yes, I guess that I will need something like the queue.
I was thinking of something like:

while (queue == 0){ schedue(); }

And wait for the interrupt to change "queue". But, isn't it a BAD
implemantation?

But if keep using cli() I will miss an interrupt eventually, right?
how do I avoid that (using cli)?

Best Regards,
Raul Dias

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/