This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: _GLIBCXX_PROFILE on non-Linux?


On Tue, Jan 19, 2010 at 7:23 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
>
> On 01/19/2010 04:20 PM, Ian Lance Taylor wrote:
> > You can diagnose it at compile time via something like
> >
> > #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
> >
> Eh, the macros I implemented a while ago turn out to be useful ;)
>
> Sure, anyway, I agree with Ian, Silvius could add something like this...
>
> Paolo.

Will do ASAP.

There is also a profile mode specific _GLIBCXX_PROFILE_NO_THREADS that
users can turn on to guarantee that programs are single-threaded.
When it's defined, profile mode pthread lock/unlock operations become
nops.  Unfortunately, the atomic operations are not guarded by it
currently.  I should perhaps add preprocessor conditionals to avoid
all calls to atomic builtins when _GLIBCXX_PROFILE_NO_THREADS is
defined.  That way, at least sequential programs will work regardless
of builtin support in the compiler.  Something like:

#ifdef _GLIBCXX_PROFILE_NO_THREADS
x = x + 1;
#else
__sync_fetch_and_add(&x, 1);
#endif

Thank you all for coming up with the report, diagnostic, plus the solution!

Silvius


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]