gettimeofday seconds rollover problem?
norume at aps.anl.gov
Fri Feb 24 19:34:03 UTC 2006
On Feb 24, 2006, at 1:09 PM, Till Straumann wrote:
> Not sure I understand exactly what you mean. Assume a (global)
> variable X
> that is not touched by an ISR. If some operation does
> Then, for sure, X is not modified by any ISR. However, the compiler
> still move X outside of the safe region (because the dispatch-
> ops are inlines) so it effectively looks like this
> with obvious consequences if a context switch occurs while X++ is
> in progress.
Yes, and the "memory" barrier will prevent this which is why I agree
that it should be added to the _Thread_Disable_dispatch and
Declaring X as volatile is orthogonal to the "memory" barrier issue.
If the X in the above example is used by multiple threads then it
needs to be volatile -- this is likely given the above example code,
but has nothing to do with the presence or absence of the memory
If the X is used by only one thread then it does not need to be
Eric Norum <norume at aps.anl.gov>
Advanced Photon Source
Argonne National Laboratory
More information about the users