[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] race condition in sleep_mode()

From: Joerg Wunsch
Subject: Re: [avr-gcc-list] race condition in sleep_mode()
Date: Tue, 27 Dec 2005 18:32:43 +0100 (MET)

Andreas Kaiser <address@hidden> wrote:

(A bit of old context in case you've got lost of the thread.)

>>That one looks a bit more sophisticated than your proposal (at least
>>from the description, I didn't really examine the patch itself), so
>>I'm considering to add it within the next couple of days.

> While the patch solves my problem, IMHO it violates the principles
> of the C language and looks like a perfect example for some peoples
> arguments to remove the preprocessor from the language.

> sleep_if() looks like a function call, yet it cannot be implemented
> as such, not even inlined, because it no longer works if the
> argument is processed the way C arguments are - the condition must
> be evaluated with interrupts disabled, ...

Upon closer inspection, I think you are right on this, and I will not
commit that part to the avr-libc version.  However, I will adopt the
implementation of sleep_enable() and sleep_disable(), as well as
sleep() (renamed to sleep_cpu() or something like that, to avoid the
confusion with the common Posix function sleep(3)), and add some
example on top that explains how to use these in a more complex
scenario, based on the suggested pseudo-algorithm you gave.

Thank you very much for your feedback on this!

>>(Btw., if you resend your message from a different address as you've
>>been told the first time the message is held for approval, please
>>also take the time to withdraw your first message.)

> ... I've sent the 2nd before I got the note, expecting the 1st one
> to be silently deleted by a spam filter.

Well, no, as the mail said, it's been forwarded to the list moderators
for approval.  As the contents of the message itself looked OK to me,
and I did not check yet the group itself by that time (which
occasionally experiences mail RTTs of several hours on the list
server), I just approved it.  In the message you got returned, there's
an option to cancel the original message on the list server, you could
even do this after resending your message using the correct sender, as
long as it wasn't already approved by one of the moderators.

(The above is not meant to be nitpicking, but I just wanted to note
this so anybody who reads about it in the archives might learn a bit
about the way the listserver works.)

cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]