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++/12658] Thread safety problems in locale::global() and locale::locale()


------- Additional Comments From peturr02 at ru dot is  2003-12-15 08:14 -------
>+    _S_initialize();
>+    _S_global->_M_add_reference();
>+    _M_impl = _S_global;

This still looks wrong. Consider if one thread runs locale::locale() and
yields after _S_global->_M_add_reference(); Another thread then runs
locale::global() from start to finish. The second thread then completes
locale::locale(). In that case locale::locale() increases the reference
count of the old global locale, but keeps a pointer to the new global locale.
The old global locale gets leaked, and the new global locale will be deleted
while there are still pointers to it.



-- 


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


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