From 05157cc8eb7cf02486585a5ef6c90539546c7149 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Tue, 11 Nov 2025 12:33:21 +0100 Subject: [PATCH] Allow injection of custom atexit procedure --- .../interprocess/detail/intermodule_singleton_common.hpp | 2 +- include/boost/interprocess/detail/workaround.hpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/boost/interprocess/detail/intermodule_singleton_common.hpp b/include/boost/interprocess/detail/intermodule_singleton_common.hpp index 1bb4f01b..ac0f3b8f 100644 --- a/include/boost/interprocess/detail/intermodule_singleton_common.hpp +++ b/include/boost/interprocess/detail/intermodule_singleton_common.hpp @@ -421,7 +421,7 @@ class intermodule_singleton_impl } BOOST_INTERPROCESS_CATCH_END } //if(Phoenix){ - std::atexit(&atexit_work); + BOOST_INTERPROCESS_ATEXIT(&atexit_work); //} atomic_inc32(&rcount->singleton_ref_count); ret_ptr = rcount->ptr; diff --git a/include/boost/interprocess/detail/workaround.hpp b/include/boost/interprocess/detail/workaround.hpp index af044b7c..ca812e09 100644 --- a/include/boost/interprocess/detail/workaround.hpp +++ b/include/boost/interprocess/detail/workaround.hpp @@ -375,4 +375,8 @@ namespace boost { #endif //!defined(DISABLE_BOOST_INTERPROCESS_EINTR_RETRY) && defined(__GNUC__) +#if !defined(BOOST_INTERPROCESS_ATEXIT) + #define BOOST_INTERPROCESS_ATEXIT(f) std::atexit((f)) +#endif //!defined(BOOST_INTERPROCESS_ATEXIT) + #endif //#ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP