From: Gaurav Dhiman <gaurav4lkg@gmail.com>
To: Robert Hancock <hancockr@shaw.ca>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: wait_event_interruptible_timeout problem
Date: Wed, 14 Sep 2005 12:01:00 +0530 [thread overview]
Message-ID: <1e33f571050913233150598e88@mail.gmail.com> (raw)
In-Reply-To: <43276101.3020104@shaw.ca>
On 9/14/05, Robert Hancock <hancockr@shaw.ca> wrote:
> 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.
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
>
> 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/
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
- Gaurav
my blog: http://lkdp.blogspot.com/
--
next prev parent reply other threads:[~2005-09-14 6:31 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 ` wait_event_interruptible_timeout problem Robert Hancock
2005-09-14 6:31 ` Gaurav Dhiman [this message]
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=1e33f571050913233150598e88@mail.gmail.com \
--to=gaurav4lkg@gmail.com \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.