There is a lock load_ref_lock and class_loader::impl::loadLibrary(getLibraryPath(), this) will not load .so library twice. Why not just use a bool is_loaded to load and unload the .so library.
I didn't see the benefits of counting times of the loadLibrary. The unloadLibrary will do nothing when load_ref_count_ > 0 too.
There is a lock
load_ref_lock
andclass_loader::impl::loadLibrary(getLibraryPath(), this)
will not load .so library twice. Why not just use a boolis_loaded
to load and unload the .so library.I didn't see the benefits of counting times of the
loadLibrary
. TheunloadLibrary
will do nothing whenload_ref_count_ > 0
too.https://github.com/ros/class_loader/blob/a183b762a81c91647c3828823b33d64fed1b6e45/src/class_loader.cpp#L100-L102