Re: interruptible_sleep_on() vs wait_event_interruptible()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----Oorspronkelijk bericht----
Van: borasahin@xxxxxxxxxxx
Datum : 21/09/2006 13:26
Aan: <kernelnewbies@xxxxxxxxxxxx>, "chris.boon@xxxxxxxxxx"<chris.
boon@xxxxxxxxxx>
Onderw: Re: interruptible_sleep_on() vs wait_event_interruptible()


Hi,

> is the only reason not to use interruptible_sleep_on() because of 
the
> race between when the driver
> decides to sleep and when the sleep_on is performed?
>
> I have an application that use lots of interrupts so missing one 
isn't
> a problem.
>
> what is the best way to make the event in wait_event_interruptible()
> atomic?
> can that be done with set_bit() and test_bit()?

If I understand you correctly, you have a wrong view point in this 
situation. 
wait_event_interruptible cannot be called from interrupt context. 
Because 
interrupt context is atomic so you cannot sleep from it. 

A typical scenario is waiting from process context using 
wait_event_interruptible or derivatives and then in interrupt code 
waking up 
those processes.

Hi,

maybe i should have explained it better..

in my read function i use wait_event_interruptible, when 
readpointer==writepointer in my linked list,  and in the interrupt 
routine i wake up the process waiting on the wait queue, after putting 
some data in the linked list. The interrupts occur every 400uS.

my question was: when i use interruptible_sleep_on() instead of 
wake_event_interruptible, is the only reason NOT to use 
interruptible_sleep_on() because of the race i mentioned above.
i dont mind then i miss a interrupt and the process isnt awaken.

thanks,

Chris.





--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux