On Sat, Mar 22, 2003 at 11:52:29PM -0500, Cliff Woolley wrote:
> On Sat, 22 Mar 2003, Craig Rodrigues wrote:
>
> > +#define apr_atomic_set(mem, val) (*(mem) = val)
> > #define apr_atomic_read(mem) (*mem)
> > +
> > +#define APR_OVERRIDE_ATOMIC_DEC 1
> > +APR_INLINE int apr_atomic_dec(apr_atomic_t *mem)
> > +{
> > + atomic_subtract_int(mem,1);
> > + return *mem;
> > +}
>
> In what way are those two implementations guaranteed atomic? I don't
> believe they are at all.
Well, the existing code for FreeBSD is wrong, so my changes are an attempt
to fix things.
The Linux code defines apr_atomic_set as:
252 #define apr_atomic_set(mem, val) (*(mem) = val)
No one seems to complain about that, so I made FreeBSD's implementation the
same.
The Netware implementation of apr_atomic_dec() is similar to what
I did for FreeBSD:
194 inline int apr_atomic_dec(apr_atomic_t *mem)
195 {
196 atomic_dec(mem);
197 return *mem;
198 }
If those implementations are good enough for those platforms,
then I fail to see what is so bad about what I did for FreeBSD.
If someone has a better fix, I'd welcome it.
--
Craig Rodrigues
http://home.attbi.com/~rodrigc
[EMAIL PROTECTED]