You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2026/03/10 05:29:27 UTC

(logging-log4cxx) branch prevent_atexit_registry_siof created (now a081c46c)

This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a change to branch prevent_atexit_registry_siof
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


      at a081c46c Prevent SIOF when linking with a Log4cxx static library

This branch includes the following new commits:

     new a081c46c Prevent SIOF when linking with a Log4cxx static library

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(logging-log4cxx) 01/01: Prevent SIOF when linking with a Log4cxx static library

Posted by sw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch prevent_atexit_registry_siof
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit a081c46cee93c7da4e0d7a4feb33fde5d20685ea
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Tue Mar 10 16:28:41 2026 +1100

    Prevent SIOF when linking with a Log4cxx static library
---
 src/main/cpp/atexitregistry.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/main/cpp/atexitregistry.cpp b/src/main/cpp/atexitregistry.cpp
index 2d5ad66b..8284dc09 100644
--- a/src/main/cpp/atexitregistry.cpp
+++ b/src/main/cpp/atexitregistry.cpp
@@ -51,21 +51,22 @@ namespace
 	private:
 		std::recursive_mutex mutex;
 		std::map<void*, std::function<void()>> actions;
-	} s_instance;
+	};
 }
 
 AtExitRegistry& AtExitRegistry::instance()
 {
-	return s_instance;
+	static AtExitRegistryImpl impl;
+	return impl;
 }
 
 void AtExitRegistry::add(void* key, std::function<void()> action)
 {
-	return s_instance.add(key, std::move(action));
+	return static_cast<AtExitRegistryImpl&>(instance()).add(key, std::move(action));
 }
 
 void AtExitRegistry::del(void* key)
 {
-	return s_instance.del(key);
+	return static_cast<AtExitRegistryImpl&>(instance()).del(key);
 }