[Pkg-ace-devel] Bug#380739: boost compiles differently,
if ACE header is included first
Harling, Torsten
THarling at arri.de
Mon Sep 25 08:25:22 UTC 2006
> -----Original Message-----
> From: Thomas Girard [mailto:thomas.g.girard at free.fr]
> Sent: Saturday, September 23, 2006 11:04 AM
> To: Harling, Torsten
> Cc: 380739 at bugs.debian.org
> Subject: Re: Bug#380739: boost compiles differently, if ACE
> header is included first
>
> Hello Torsten,
>
> On Mon, Aug 07, 2006 at 07:08:39PM +0200, Thomas Girard wrote:
> > > > Another way of enforcing correct flags would be to
> check whether
> > > > symbol _REENTRANT is defined, and if it is not, the
> header could
> > > > abort compilation with an #error stating _REENTRANT
> *must* be defined.
> > > >
> > > > I am not convinced this is better. What do you think?
> > >
> > > We first used shared_ptr's about 3 or 4 years ago. That's
> when this
> > > bug hid itself undetected in our software. We only wondered, why
> > > using a shared_ptr would sometimes cause our software to hang.
> > >
> > > The cause was, that mostly the shared_ptr ended up having
> no mutex.
> > > But, if a piece of code included the ace headers first, it might
> > > hang when using a shared_ptr, that was constructed in a different
> > > compilation unit.
> > >
> > > An #error stating _REENTRANT *must* be defined, or even better,
> > > saying -pthread(s) *must* be used, would have prevented and fixed
> > > our bug a long time ago. I agree, that the latter would be more
> > > difficult, as you would have to figure out the correct option for
> > > different compilers and architectures.
> > >
> > > So, I would recommend the #error.
> > >
> > > The boost library also #error's out, if it requires
> multithreading
> > > support.
>
> I have a fix for this bug, and it seems to work.
>
> But using boost 1.33.1-7 (from unstable) on your example no
> longer works (with or without my patch). Indeed now boost
> #define _REENTRANT, because <memory> gets included to use
> libstdc++ allocator. If you believe that's a problem, please
> file a bug on boost.
>
> I am disabling the patch because with it, we would have another
> problem: including a boost header first works, but including
> an ACE header first would error out.
>
> The patch is attached to this email.
>
> What is your opinion on this?
>
Hi,
thanks for the patch. It will work for us.
I don't know, if the -pthread option of gcc does anything
besides defining _REENTRANT (and adding -lpthread to ld).
If it does, that might also cause trouble, but that would
not be an ACE problem.
BTW: Boost 1.33 does not need a pthread_mutex for a shared_ptr.
Instead that version uses atomic operations to change the
counters, so that my initial problem would have vanished
automatically, if we used a newer boost version.
Thanks,
Torsten
More information about the Pkg-ace-devel
mailing list