libstdc++/7445: poor performance of std::locale::classic() in multi-threaded applications
shurik@sequoiap.com
shurik@sequoiap.com
Tue Jul 30 12:50:00 GMT 2002
>Number: 7445
>Category: libstdc++
>Synopsis: poor performance of std::locale::classic() in multi-threaded applications
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jul 30 11:46:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Alex Kompel
>Release: gcc version 3.1.1
>Organization:
>Environment:
RedHat Linux 7.3
>Description:
poor performance of std::locale::classic() in multi-threaded applications. std::locale:classic() is using _STL_auto_lock too extensively. It should only be used when the locale object is initialized. It does locks the mutex
on every call at present. See the fix below.
>How-To-Repeat:
>Fix:
*** libstdc++-v3/src/locale.old Tue Jul 30 11:31:01 2002
--- libstdc++-v3/src/locale.cc Tue Jul 30 11:31:13 2002
***************
*** 285,294 ****
locale::classic()
{
static _STL_mutex_lock __lock __STL_MUTEX_INITIALIZER;
- _STL_auto_lock __auto(__lock);
if (!_S_classic)
{
try
{
// 26 Standard facets, 2 references.
--- 285,294 ----
locale::classic()
{
static _STL_mutex_lock __lock __STL_MUTEX_INITIALIZER;
if (!_S_classic)
{
+ _STL_auto_lock __auto(__lock);
try
{
// 26 Standard facets, 2 references.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list