libstdc++/7445: poor performance of std::locale::classic() in multi-threaded applications
Benjamin Kosnik
bkoz@redhat.com
Thu Aug 8 23:20:00 GMT 2002
> OK, I'd be happy to find a performance fix that doesn't make the
> library code subtly less portable when we have a test case. A
> reference to code already in our test suite would be acceptable.
Yeah. This is kind of all hand-wavy at this point.
> Benjamin (as the "local locale" expert), is it *always* true that
> std::locale::classic() is called at least once during startup before
> control is transferred to main()? If so (and will always be so), then
> all thread-related locking could be removed IMHO. In practice, our
> implementation of the Standard C++ library (with optional threading
> support) already supposes that no thread which uses the library
> implementation may have ever been started before main() is invoked.
> If not true, then this change would make a very hard to detect
> threading bug when the assumption changes.
This is true. I would think the lock could then be removed? I'll let you
figure out what to do with current sources. Thanks for the help.
-benjamin
More information about the Gcc-bugs
mailing list