This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Problem with `string', threading and shared libraries.
- To: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- Subject: Re: Problem with `string', threading and shared libraries.
- From: Carlo Wood <carlo at alinoe dot com>
- Date: Tue, 2 Oct 2001 04:33:19 +0200
- Cc: libstdc++ at gcc dot gnu dot org
- References: <20010928164914.A32098@alinoe.com> <fly9my2fce.fsf@jambon.cmla.ens-cachan.fr> <200110020138.f921cCK45265@latour.rsch.comm.mot.com>
On Mon, Oct 01, 2001 at 08:38:12PM -0500, Loren James Rittle wrote:
> In article <fly9my2fce.fsf@jambon.cmla.ens-cachan.fr> you write:
> >Carlo Wood <carlo@alinoe.com> writes:
> >
> >| I really think that it was a wrong decision to include
> >| thread-safeness in the mangling of std::string.
> >
> > So we're at least two then.
>
> When you agree with Carlo on this matter, be sure you fully understand
> what you are agreeing to.
>
> He had compiled libstdc++ with a macro, reserved to the
> implementation, defined and then he compiled his user code without
> that macro defined. Nowhere do we document that macro being used by
> normal users of the library.
I defined it while compiling my own library (libcwd), not while compiling
libstdc++. I read about _NOTHREADS in documentation of SGI. There I had
the feeling that it was recommended to define it for single threaded
application (to speed things up).
> Here is what we say in internal configuration documentation of the
> library, libstdc++-v3/include/bits/c++config :
>
> // [...] Note:
> // that gthr.h may well map to gthr-single.h which is a correct way to
> // express no threads support in gcc. As a user, do not define
> // _NOTHREADS without consideration of the consequences (e.g. it is an
> // internal ABI change).
>
> Note that it is explicitly marked as something that will change the
> ABI (i.e., you can't link code compiled with and without that macro
> defined). I honestly don't know how much more of a warning is merited
> for a symbol outside the normal user-space.
I didn't dig into libstdc++ internal configuration documentation for more
information :p, so the only "documentation" I had that I shouldn't touch it
was the fact that it starts with an underscore.
Just being used to _REENTRANT, which must be defined by the user when
compiling a thread-safe application AFAIK, it escaped me that I should not
define _NOTHREADS despite the mention of it somewhere in the many documentations
I read (sorry, I am new to threading since three weeks or so; I read so much
I have NO idea where I read it).
Thanks for clarifying this however :).
I'll remove the #define from my debugging library.
(I had still defined it for 3.0 and higher).
--
Carlo Wood <carlo@alinoe.com>