sleep_on problems

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

 



Hi, 
I have the following piece of code, interestingly any 
line of code after sleep_on will not get executed.
Also what is the difference between
interruptible_sleep_on and sleep_on, when do you use
one versus other? Also for the different types of
spin_lock, 
when do you decide you need one over the other?

Thanks
Heap-Ho

Note in this case if sleep_on suspends the current
process, there will be a deadlock situation, is there
anyway out of this??

asmlinkage int myeventwait(int eventID)
{
  struct list_head *tmp;
  struct eventDest *eventtmp;
  list_for_each(tmp, &event_head){
    eventtmp = list_entry(tmp, struct eventDest,
event_list);
    spin_lock_irq(&eventtmp->eventLock);
    if(eventtmp->eventID == eventID){
      //printk("In eventwait and evenID: %d\n",
eventtmp->eventID);
      eventtmp->nb_process=eventtmp->nb_process+1;
      //printk("No of processes waiting: %d\n",
eventtmp->nb_process);
      sleep_on(&(eventtmp->queue));
      spin_unlock_irq(&eventtmp->eventLock);
      return 1;
    }
    spin_unlock_irq(&eventtmp->eventLock);
  }
  return -1;
}

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