From: milton@krutt.org (Milton Krutt)
To: kernelnewbies@lists.kernelnewbies.org
Subject: apparent sleep
Date: Mon, 23 Mar 2015 05:31:51 -0700 [thread overview]
Message-ID: <20150323123151.GB4484@debian> (raw)
Hi.
Following LDD3, I am dealing with wait queues, on a 2.6.10.
My loop is like:
while(enough()){
prepare_to_wait(&queue_head, &queue_entry, TASK_INTERRUPTIBLE);
atomic_set(&flag, 0);
if (!atomic_read(&flag, 0))
schedule();
finish_wait(&queue_head, &queue_entry);
}
My intention is to wake up the process at each loop by issuing CTRL^D.
Here is what happens:
the first time the process yields the processor, it actually sleeps and
I have to give it a CTRL^D in order to put it again in running state;
unfortunately, in the following loops, although it calls the schedule()
function, it magically regains the processor putting hisself in a running
state (since it runs, I guess the state is a running one).
In a few words, the while loop has thousands of iterations, but CTRL^D is
needed only during the first one.
Thank you all
next reply other threads:[~2015-03-23 12:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-23 12:31 Milton Krutt [this message]
2015-03-23 19:49 ` apparent sleep Greg KH
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=20150323123151.GB4484@debian \
--to=milton@krutt.org \
--cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).