compile time constants for selecting thread functionality

Paolo Carlini pcarlini@suse.de
Fri Sep 1 15:44:00 GMT 2006


Benjamin Kosnik wrote:

>include/tr1/boost_shared_ptr.h:
>// TODO This should go into a separate header really.
>enum _Lock_policy { _S_lockfree, _S_mutex, _S_single }; 
>
>static const _Lock_policy __shared_ptr_default_lock_mode = 
>#ifdef __GTHREADS
>// NOTE: This doesn't actually exist yet in the compiler.
>#ifdef _GLIBCXX_ATOMIC_BUILTINS
>  _S_lockfree;
>#else
>  _S_mutex;
>#endif
>#else
>  _S_single;
>#endif
>  
>
Only one comment (I have yet to digest your entire email ;) : about 
shared_ptr, where there are no issues wrt the built library and so on, 
it's all in the header, I was more or less assuming that 
_GLIBCXX_ATOMIC_BUILTINS was about to go in favor of a "fine grained" 
(i.e., sensitive to current sub-target, like i386 vs i486) preprocessor 
builtin, named, according to Mark's indications, 
__GCC_HAVE_ATOMIC_BUILTINS. As a matter of fact, I have here an almost 
done patch, developed with Paolo Bonzini, which implements the builtin, 
I should post it in a few days... I'm not sure how that will fit in your 
whole picture, but I think you can confidently assume that for 4.3 or 
even 4.2 (if we are "lucky" ;) such preprocessor builtin will be 
available for the uses you want to make of it...

Paolo.



More information about the Libstdc++ mailing list