[Pkg-ace-devel] Bug#380739: boost compiles differently, if ACE header is included first

Thomas Girard thomas.g.girard at free.fr
Sat Sep 23 09:04:27 UTC 2006


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?

Thanks,

Thomas
-------------- next part --------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## 20-check-_REENTRANT.dpatch by Thomas Girard <thomas.g.girard at free.fr>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Rather than #defining _REENTRANT if it's not yet defined, #error out
## DP: See Debian bug #380739.

@DPATCH@
--- ACE_wrappers.orig/ace/config-lite.h 	2006-09-10 21:51:38.312980000 +0200
+++ ACE_wrappers/ace/config-lite.h 	2006-09-10 21:36:50.861517750 +0200
@@ -68,7 +68,7 @@
 # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
 #   define ACE_MT(X) X
 #   if !defined (_REENTRANT)
-#     define _REENTRANT
+#     error _REENTRANT has to be defined!
 #   endif /* _REENTRANT */
 # else
 #   define ACE_MT(X)


More information about the Pkg-ace-devel mailing list