Add LoadableLibraryManager and refactor StimBuffApiManager to use it.
Centralize dlopen/search in LoadableLibraryManager so typed library managers can share one loaded-shlib registry without duplicating load/unload logic. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,7 +21,7 @@ class StimBuffApiManager
|
||||
public:
|
||||
struct Resources
|
||||
{
|
||||
std::vector<std::shared_ptr<StimBuffApiLib>> stimBuffApiLibs;
|
||||
std::vector<std::shared_ptr<StimBuffApiLib>> libs;
|
||||
};
|
||||
|
||||
static StimBuffApiManager& getInstance()
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
const std::string& libraryPath,
|
||||
const std::shared_ptr<sscl::ComponentThread>& componentThread);
|
||||
|
||||
std::optional<std::shared_ptr<StimBuffApiLib>> getStimBuffApiLib(
|
||||
std::optional<std::shared_ptr<StimBuffApiLib>> findStimBuffApiLibByLibraryPath(
|
||||
const std::string& libraryPath);
|
||||
std::optional<std::shared_ptr<StimBuffApiLib>> findStimBuffApiLibByApiName(
|
||||
const std::string& apiName);
|
||||
@@ -48,19 +48,21 @@ public:
|
||||
|
||||
void loadAllStimBuffApiLibsFromOptions(
|
||||
const std::shared_ptr<sscl::ComponentThread>& componentThread);
|
||||
|
||||
void unloadAllStimBuffApiLibs(void);
|
||||
|
||||
body::BodyViralPostingInvoker<void> initializeStimBuffApiLibCReq(
|
||||
StimBuffApiLib &lib, bool acquireSbamLock=true);
|
||||
StimBuffApiLib &lib, bool acquireListLock=true);
|
||||
body::BodyViralPostingInvoker<void> finalizeStimBuffApiLibCReq(
|
||||
StimBuffApiLib &lib, bool acquireSbamLock=true);
|
||||
StimBuffApiLib &lib, bool acquireListLock=true);
|
||||
|
||||
body::BodyViralPostingInvoker<void> initializeAllStimBuffApiLibsCReq();
|
||||
body::BodyViralPostingInvoker<void> finalizeAllStimBuffApiLibsCReq();
|
||||
|
||||
std::string stringifyLibs() const;
|
||||
|
||||
public:
|
||||
sscl::SharedResourceGroup<sscl::co::CoQutex, Resources> s;
|
||||
|
||||
private:
|
||||
StimBuffApiManager()
|
||||
: s("StimBuffApiManager")
|
||||
@@ -70,13 +72,6 @@ private:
|
||||
|
||||
StimBuffApiManager(const StimBuffApiManager&) = delete;
|
||||
StimBuffApiManager& operator=(const StimBuffApiManager&) = delete;
|
||||
|
||||
public:
|
||||
sscl::SharedResourceGroup<sscl::co::CoQutex, Resources> s;
|
||||
|
||||
public:
|
||||
static std::optional<std::string> searchForLibInSmoSearchPaths(
|
||||
const std::string& libraryPath);
|
||||
};
|
||||
|
||||
} // namespace stim_buff
|
||||
|
||||
Reference in New Issue
Block a user