From: Robert Hancock <hancockr@shaw.ca>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: wait_event_interruptible_timeout problem
Date: Tue, 13 Sep 2005 17:30:09 -0600 [thread overview]
Message-ID: <43276101.3020104@shaw.ca> (raw)
In-Reply-To: <4MjuE-6Cb-37@gated-at.bofh.it>
manomugdha biswas wrote:
> 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 */
>
> 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.
--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/
next parent reply other threads:[~2005-09-13 23:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4MjuE-6Cb-37@gated-at.bofh.it>
2005-09-13 23:30 ` Robert Hancock [this message]
2005-09-14 6:31 ` wait_event_interruptible_timeout problem Gaurav Dhiman
2005-09-13 13:51 manomugdha biswas
2005-09-14 6:14 ` manomugdha biswas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43276101.3020104@shaw.ca \
--to=hancockr@shaw.ca \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox