iceoryx
iceoryx copied to clipboard
Create singleton abstraction to avoid static destruction order problems
Brief feature description
The standard singleton implementation (static variable in function scope) does not allow multiple constructors and causes problems with destruction order if static variables depend on each other.
To avoid static destruction order problems a more general singleton abstraction can be created.
Detailed information
- singleton abstraction shall allow destruction on demand
- singleton abstraction shall allow arbitrary multi argument ctors
TBD
This issue is not urgent and I will just move the ongoing PR https://github.com/eclipse-iceoryx/iceoryx/pull/1648 to this issue (requires changing commits and branch names etc.) This means the PR will be closed and reopened later after some updates.
@elBoberido We can also think about the singleton dependency graph here.
This is low prio and will be worked on when there is some time.
Solved with the StaticLifetimeGuard
in #1656 which basically manages a singleton that can be constructed lazily and whose lifetime can be controlled by guards. This class should satisfy all constraints stated here. so far
I therefore think this issue can be closed. We can consider optimizations and generalizations later.
Do you agree? @elBoberido
@MatthiasKillat yes, this should be solved by the StaticLifetimeGuard