This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug libstdc++/20979] __gnu_cxx::bitmap_allocator export pruning


------- Additional Comments From bkoz at gcc dot gnu dot org  2005-04-13 16:32 -------
I posit that this usage of static local variables, as written, is thread safe
with gcc-4.0.x compilers. (Since resolution of c++/13684).

!     _Mutex*
!     _M_get_mutex()
!     {
!       static _Mutex _S_mutex;
!       return &_S_mutex;
!     }

This object is only constructed (and initialized) once. After initial
construction, a pointer to the initial object is returned. Don't let the
simplicity of this solution fool you!

This change actually improves portability for initialization, especially on
non-SVR4 platforms, where order of initalization of static objects may differ
from expectations.

-benjamin




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20979


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