This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Atomic types


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]