aboutsummaryrefslogtreecommitdiffstats
path: root/src/iostream.cpp
diff options
context:
space:
mode:
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