aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-11-19 12:26:49 +0000
committerJonathan Wakely <jwakely@redhat.com>2021-11-19 20:22:52 +0000
commit5faf1c8c7ab64340945972ee5acb9eb0a655567a (patch)
treeab1a05f24e1885afd867d1d41ce649fc0cc5a2e7 /libgcc
parent1f8d01eb1476a997eb1fc686b60fccdf97747faa (diff)
downloadgcc-5faf1c8c7ab64340945972ee5acb9eb0a655567a.zip
gcc-5faf1c8c7ab64340945972ee5acb9eb0a655567a.tar.gz
gcc-5faf1c8c7ab64340945972ee5acb9eb0a655567a.tar.bz2
libstdc++: Use __is_single_threaded in locale initialization
This replaces a __gthread_active_p() check with __is_single_threaded() so that std::locale initialization doesn't use __gthread_once if it happens before the first thread is created. This means that _S_initialize_once() might now be called twice instead of only once, because if __is_single_threaded() changes to false then we will do the __gthread_once call even if _S_initialize_once() was already called. Add a check to _S_initialize_once() and return immediately if it is the second call. Also use __builtin_expect to _S_initialize, as the branch will be taken at most once in the lifetime of the program. libstdc++-v3/ChangeLog: * src/c++98/locale_init.cc (_S_initialize_once): Check if initialization has already been done. (_S_initialize): Replace __gthread_active_p with __is_single_threaded. Use __builtin_expect.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions