Follow-up from issue #116 (review finding #9).
xmscore/misc/Singleton.h:81-121 — SharedSingleton<T>::Instance(Ptr a_new = Ptr(), bool a_delete = false) has the same conflated get/install/destroy shape as Singleton<T> (#116-followup-singleton), plus:
- A second installer call silently clobbers the first. The precondition assert is commented out.
- No documented thread-safety expectations; concurrent first-time installs race.
Proposed change
- Replace with explicit methods:
Get() — returns the current shared_ptr.
Install(Ptr) — install a replacement; either fail loudly on a second install or document the policy.
Reset() — tear down.
- Either guard install with
std::call_once / a std::mutex, or document explicitly that callers are responsible for serializing installs.
- Document interaction with in-flight users of the previous instance.
Why follow-up, not part of #117
The new \brief in #117 names this type as the canonical CRTP base for xmscore singletons. The actual fix needs its own type-design review.
Acceptance
Refs: issue #116, PR #117.
Follow-up from issue #116 (review finding #9).
xmscore/misc/Singleton.h:81-121—SharedSingleton<T>::Instance(Ptr a_new = Ptr(), bool a_delete = false)has the same conflated get/install/destroy shape asSingleton<T>(#116-followup-singleton), plus:Proposed change
Get()— returns the currentshared_ptr.Install(Ptr)— install a replacement; either fail loudly on a second install or document the policy.Reset()— tear down.std::call_once/ astd::mutex, or document explicitly that callers are responsible for serializing installs.Why follow-up, not part of #117
The new
\briefin #117 names this type as the canonical CRTP base for xmscore singletons. The actual fix needs its own type-design review.Acceptance
Get()/Install()/Reset()exist; combinedInstance(Ptr, bool)marked deprecatedInstall()either errors loudly or is documented as last-write-winsRefs: issue #116, PR #117.