From 8caa48e9b6997a587fc7f931ca34e1da3425837f Mon Sep 17 00:00:00 2001 From: Philipp Geier Date: Wed, 11 Sep 2024 08:16:35 +0000 Subject: [PATCH] Add comments to note about possible problems --- src/eckit/log/Log.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/eckit/log/Log.cc b/src/eckit/log/Log.cc index d3f03fc53..21932d428 100644 --- a/src/eckit/log/Log.cc +++ b/src/eckit/log/Log.cc @@ -127,6 +127,8 @@ Channel& Log::info() { } if (Main::finalised()) { + // This may still cause a SEGFAULT due to missing destruction order at the end of library life time + // - only solution is then to use an empty channel which is harmless in a destructed state thread_local Channel postMainInfo(new PrefixTarget("POST-MAIN-INFO", new OStreamTarget(std::cout))); return postMainInfo; } @@ -142,6 +144,8 @@ Channel& Log::error() { } if (Main::finalised()) { + // This may still cause a SEGFAULT due to missing destruction order at the end of library life time + // - only solution is then to use an empty channel which is harmless in a destructed state thread_local Channel postMainError(new PrefixTarget("POST-MAIN-ERROR", new OStreamTarget(std::cout))); return postMainError; } @@ -157,6 +161,8 @@ Channel& Log::warning() { } if (Main::finalised()) { + // This may still cause a SEGFAULT due to missing destruction order at the end of library life time + // - only solution is then to use an empty channel which is harmless in a destructed state thread_local Channel postMainWarning(new PrefixTarget("POST-MAIN-WARNING", new OStreamTarget(std::cout))); return postMainWarning; } @@ -177,6 +183,8 @@ Channel& Log::debug() { if (!Main::instance().debug_) { return emptyChannel_; } if (Main::finalised()) { + // This may still cause a SEGFAULT due to missing destruction order at the end of library life time + // - only solution is then to use an empty channel which is harmless in a destructed state thread_local Channel postMainDebug(new PrefixTarget("POST-MAIN-DEBUG", new OStreamTarget(std::cout))); return postMainDebug; }