This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Atomic types
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: manu shetty <shetty_m at yahoo dot com>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: 02 Aug 2006 12:41:55 +0100
- Subject: Re: [ECOS] Atomic types
- References: <20060802104124.53247.qmail@web51705.mail.yahoo.com>
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