From: der.herr@hofr.at (Nicholas Mc Guire)
To: kernelnewbies@lists.kernelnewbies.org
Subject: set_current_state() use in loops confusion
Date: Sun, 7 Jun 2015 18:37:48 +0200 [thread overview]
Message-ID: <20150607163748.GA17643@opentech.at> (raw)
Hi !
Noticed that in a number of cases - often while(!kthread_should_stop()){ loops
the call to set_current_state(...) is inside the loop - but e.g. in the below
case why would that be needed ? schedule() is not changing the state visibly
for the loop - so what is the point of setting the state inside the loop ?
e.g. net/core/pktgen.c
/* Wait for kthread_stop */
while (!kthread_should_stop()) {
set_current_state(TASK_INTERRUPTIBLE);
schedule();
}
from code review it seems to be that this would be equivalent
set_current_state(TASK_INTERRUPTIBLE);
while (!kthread_should_stop()) {
schedule();
}
what did I miss ?
thx!
hofrat
next reply other threads:[~2015-06-07 16:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-07 16:37 Nicholas Mc Guire [this message]
2015-06-08 10:06 ` set_current_state() use in loops confusion Nicholas Mc Guire
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=20150607163748.GA17643@opentech.at \
--to=der.herr@hofr.at \
--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 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.