wait_event_interruptible_timeout problem
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 15 lines · manomugdha biswas
Hi,
I have a kernel module (kernel 2.6) where I have opened multiple tcp connections. when there is no data
i want my process to sleep. For that i have added the
following code./* Initialise the wait q head */
init_waitqueue_head(&VNICClientWQHead);
init_waitqueue_entry(&(currentMap->waitQ), current);add_wait_queue(currentMap->sock->sk->sk_sleep, &(currentMap->waitQ));
Quoted 8 lines
/* here currentMap is a structure containing tcp conenction info for my module. There is a currentMap for each tcp connection */
wait_event_interruptible_timeout(VNICClientWQHead,
0, HZ * 100000);I am not sure about the condition argument, 0.
The condition should be an expression that returns true when whatever you are waiting for occurs - in this case when data is available. If you put the condition as 0 it will never wake up.
Also, why the huge timeout? If you just want to sleep forever, use regular wait_event_interruptible.
Signature · 3 lines
Robert Hancock Saskatoon, SK, Canada To email, remove "nospam" from [email protected] Home Page: http://www.roberthancock.com/
Quoted 20 lines · Robert Hancock
Quoted 19 lines · manomugdha biswas
Hi,
I have a kernel module (kernel 2.6) where I have opened multiple tcp connections. when there is no data
i want my process to sleep. For that i have added the
following code./* Initialise the wait q head */
init_waitqueue_head(&VNICClientWQHead);
init_waitqueue_entry(&(currentMap->waitQ), current);add_wait_queue(currentMap->sock->sk->sk_sleep, &(currentMap->waitQ));/* here currentMap is a structure containing tcp conenction info for my module. There is a currentMap for each tcp connection */
Quoted 8 lines
Quoted 4 lines
wait_event_interruptible_timeout(VNICClientWQHead,
0, HZ * 100000);I am not sure about the condition argument, 0.
The condition should be an expression that returns true when whatever you are waiting for occurs - in this case when data is available. If you put the condition as 0 it will never wake up.
On timeout it will wake up, even if the condition is 0 ..... bu in this case the time out is too big. Try with small timeout value and you will see that your process wakes up.
-Gaurav
Quoted 16 lines
Also, why the huge timeout? If you just want to sleep forever, use regular
wait_event_interruptible.--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from [email protected] Home Page: http://www.roberthancock.com/-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 3 lines
- Gaurav my blog: http://lkdp.blogspot.com/ --