[ECOS] Atomic types
Nick Garnett
nickg@ecoscentric.com
Wed Aug 2 11:42:00 GMT 2006
manu shetty <shetty_m@yahoo.com> writes:
> So, if I define the variable as atomic then the
> following operation happens uninterruptible
>
> cyg_halatomic i;
> i=0;
> i+=1;
> i-=1;
No. As the documentation says, all it guarantees is that reads or
writes are performed atomically, usually by a single instruction,
rather than a sequence of loads or stores. So "i=0" will be atomic,
but "i+=1" will comprise a read and a write and will not be atomic.
--
Nick Garnett eCos Kernel Architect
http://www.ecoscentric.com The eCos and RedBoot experts
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss
mailing list