public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: shurik@sequoiap.com
To: gcc-gnats@gcc.gnu.org
Subject: libstdc++/7445: poor performance of std::locale::classic() in multi-threaded applications
Date: Tue, 30 Jul 2002 11:46:00 -0000	[thread overview]
Message-ID: <20020730183705.12180.qmail@sources.redhat.com> (raw)


>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:


             reply	other threads:[~2002-07-30 18:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-30 11:46 shurik [this message]
2002-07-31 12:35 bkoz
2002-08-02  9:25 bkoz
2002-08-08 17:06 bkoz
2002-08-08 23:26 Loren James Rittle
2002-08-09  2:26 Benjamin Kosnik
2002-11-19 12:31 bkoz
2002-11-19 12:46 Alex Kompel
2002-11-19 12:46 Benjamin Kosnik
2002-11-19 18:16 Alex Kompel
2002-11-19 18:27 bkoz
2002-11-19 18:31 ljrittle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020730183705.12180.qmail@sources.redhat.com \
    --to=shurik@sequoiap.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).