This is the mail archive of the gcc-patches@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] |
The global locale::_Impl that represents the "C" locale is never destroyed, so there is no need to keep track of reference count updates for that object. This greatly reduce contention between threads that refer to the classic locale. Since the global std::locale initially uses the classic locale, this benefits the common case for any code using the global locale, such as construction/destruction of iostream objects. All these updates are done inside libstdc++.so so there's no need to worry about users' objects having inlined old versions of the code which still update the reference count for the classic locale. PR libstdc++/59439 * src/c++98/locale.cc (locale::locale(const locale&)): Bypass reference count updates for the classic locale. (locale::~locale()): Likewise. (locale::operator=(const locale&)): Likewise. * src/c++98/locale_init.cc (locale::locale()): Likewise. (locale::global(const locale&)): Likewise. Tested x86_64-linux, not committed yet. Does anybody see any problems with this change?
Attachment:
patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |