wait_evnet() can't be waked up in interrupt handler???

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

 



hi, all:

    I use wait_event_interruptible(Wrhead, condition) in linux driver, while the
 condition is not true, put it sleep, and wait the condition to be true, in a
interrupt handler, the condition will be changed to true and wake_up() the sleep.

    The question is the wait_event_interruptible() can't be waked up in some
time, the process has sleep on the wait_event(), and after this, it get one
interrupt, and also set the condition to be true, then wake_up() the process,
but it still sleeps...
if there is still some race condition? what should I do?

    Followwing is my code:

ssize_t my_write(struct file *file, const char *buffer, 
                          size_t length,loff_t *offset)
{
    ....
    //the num now is a non zero number
    wait_event_interruptible(WrWait, num==0); 
    copy_from_user(...);
    ....
}

void interrupt_handler(int irq, void *dev_id, struct pt_regs *regs)
{
    ...
    num=0;
    wake_up_interruptible(&WrWait);
    ...
}


--
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