sleep process, wait queues

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

 



#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/wait.h>
#include <linux/sched.h>
#include <linux/list.h>
MODULE_LICENSE("GPL");
                                                      
                                          
static DECLARE_WAIT_QUEUE_HEAD (my_queue);
int init_module(void)
{
        struct task_struct *my_task ;
        my_task = find_task_by_pid(1477);
        DECLARE_WAITQUEUE(wait, my_task);
        my_task->state = TASK_UNINTERRUPTIBLE ;
        init_waitqueue_entry( &wait, my_task);
        add_wait_queue( &my_queue , &wait);
        sleep_on(&my_queue);
        interruptible_sleep_on(&my_queue);
        schedule( );
        return 0;
}


void cleanuo_module()
{
        printk("Bye");
        wake_up( &my_queue );
}




Hi  everyone,

In the above module I want to sleep the process having
pid 1477 ( which is mpg123 player in my case in wait
queue ). Instead of sleeping the process with the
given pid it is hanging insmod command. so plz tell me
what is wrong in the above code.

Thanks for replays in Advance,
Thanks and regards
Deepak Joshi.



		
___________________________________________________________ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

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