aboutsummaryrefslogtreecommitdiffstats
path: root/src/iostream.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:52:30 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:52:30 +0000
commit243a6be085fe6a7ce49169864c68a8839735e49b (patch)
treeabfecf3c23dc7512ca48e72ac418b149c865e0f3 /src/iostream.cpp
parent1147845301c03308e3419b89c28c77bb6917fe04 (diff)
downloadsrc-vendor/libc++.tar.gz
src-vendor/libc++.zip
Vendor import of stripped libc++ trunk r375505, the last commit beforevendor/libc++/libc++-trunk-r375505vendor/libc++
the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/libcxx/trunk@375505
Notes
Notes: svn path=/vendor/libc++/dist/; revision=353946 svn path=/vendor/libc++/libc++-r375505/; revision=353947; tag=vendor/libc++/libc++-trunk-r375505
Diffstat (limited to 'src/iostream.cpp')
-rw-r--r--src/iostream.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/iostream.cpp b/src/iostream.cpp
index 0a5d6e8d2264..ad1920abc657 100644
--- a/src/iostream.cpp
+++ b/src/iostream.cpp
@@ -97,7 +97,13 @@ static void force_locale_initialization() {
#endif
}
-ios_base::Init::Init()
+class DoIOSInit {
+public:
+ DoIOSInit();
+ ~DoIOSInit();
+};
+
+DoIOSInit::DoIOSInit()
{
force_locale_initialization();
@@ -126,7 +132,7 @@ ios_base::Init::Init()
#endif
}
-ios_base::Init::~Init()
+DoIOSInit::~DoIOSInit()
{
#ifndef _LIBCPP_HAS_NO_STDOUT
ostream* cout_ptr = reinterpret_cast<ostream*>(cout);
@@ -141,4 +147,13 @@ ios_base::Init::~Init()
wclog_ptr->flush();
}
+ios_base::Init::Init()
+{
+ static DoIOSInit init_the_streams; // gets initialized once
+}
+
+ios_base::Init::~Init()
+{
+}
+
_LIBCPP_END_NAMESPACE_STD