Rye/llsingleton dll safe#328
Conversation
… LLParamSingleton Make LLSingleton safe for a future shared (multi-DLL) llcommon and restore LLParamSingleton so the DLL-unsafe LLSimpleton can be retired, without reintroducing the per-access mutex locking that motivated LLSimpleton. Storage: per-type instance state moves out of the per-T function-local/template static (which duplicates once per module under DLLs) into a single process-wide registry owned by LLSingletonBase::getSlot() in llsingleton.cpp. Every module resolves the same SingletonSlot; LLSingleton<T> keeps only a per-module cache of the slot's stable address. The registry is keyed by the mangled name string (typeid(T).name()), not std::type_index: we build with -fvisibility=hidden, so each module has its own type_info object for T and type_index would compare unequal across modules and duplicate the slot. Performance: getInstance()/instanceExists() take a lock-free fast path in steady state -- an acquire load of an atomic instance pointer published only at INITIALIZED. Dependency tracking is fully preserved: the fast path is gated on a process-wide sInitializingDepth counter, so whenever any singleton is mid-init every caller falls back to the locked, capture_dependency() path. DLL export: mark class LLSingletonBase LL_COMMON_API so its out-of-line methods, getSlot, and sInitializingDepth are reachable across module boundaries. Restore LLParamSingleton and LLLockedSingleton (adapted to the slot internals + fast path) and their unit tests. INTEGRATION_TEST_llsingleton: 15/15 pass, including the dependency-ordered deleteAll() checks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedToo many files! This PR contains 226 files, which is 76 over the limit of 150. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (226)
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Related Issues
Issue Link:
Checklist
Please ensure the following before requesting review:
Additional Notes