bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/11] include: add lock-less reference counting primitives


From: Samuel Thibault
Subject: Re: [PATCH 03/11] include: add lock-less reference counting primitives
Date: Tue, 13 May 2014 00:44:45 +0200
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Richard Braun, le Tue 13 May 2014 00:36:44 +0200, a écrit :
> On Tue, May 13, 2014 at 12:23:48AM +0200, Samuel Thibault wrote:
> > Justus Winter, le Mon 12 May 2014 12:05:41 +0200, a écrit :
> > > +  const union _references op = { .refs = { .hard = 1 } };
> > > +  refcounts_t r = __atomic_add_fetch (ref, op.rc, __ATOMIC_RELAXED);
> > 
> > Mmm, I don't think it is allowed by C to write into a field and read
> > from another field.  The legacy Hurd code used to tend to do it in some
> > places, but it breaks with smart compilers.
> 
> It's not defined by C, but all major compilers support it as it's the
> cleanest way, if done properly, not to violate strict aliasing currently.

Right, we only care about gcc.  We probably want to make sure we have
this extension, though, by rejecting any other compiler than gcc, for
instance.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]