From: "Francis Moreau" <francis.moro@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Question about C language.
Date: Fri, 21 Mar 2008 16:46:09 +0100 [thread overview]
Message-ID: <38b2ab8a0803210846p2f9b92adr951fe7fa0444de63@mail.gmail.com> (raw)
Hello,
I know it's a bit out of topic but this is something I need to clarify for
writing a Linux driver... hope you don't mind.
In my driver I have a global variable that controls a loop such as:
int my_condition;
void change_my_condition(int new)
{
my_condition = new;
}
int foo(void)
{
/* irqs are disabled */
my_condition = 1;
do {
....
local_irq_enable();
cpu_sleep();
local_irq_disable();
} while (my_condition);
}
This variable is modified by an interrupt handler define in another file
by using 'change_my_condition' function.
By reading the ISO C99 specification, I _think_ that I needn't any
kind of barrier
or even use the volatile type qualifier for my_condition variable to make a true
access to 'my_condition' in the controlling expression of the while, but I'm not
sure.
Coud anybody confirm ?
Thanks,
--
Francis
next reply other threads:[~2008-03-21 15:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-21 15:46 Francis Moreau [this message]
2008-03-23 7:30 ` Chris Snook
2008-03-23 7:32 ` Chris Snook
2008-03-24 8:25 ` Francis Moreau
2008-03-24 8:24 ` Francis Moreau
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=38b2ab8a0803210846p2f9b92adr951fe7fa0444de63@mail.gmail.com \
--to=francis.moro@gmail.com \
--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
all inboxes | Powered by JetHome®