MCPcopy Create free account
hub / github.com/COVESA/vsomeip / unload_plugin

Method unload_plugin

implementation/plugin/src/plugin_manager_impl.cpp:78–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78bool plugin_manager_impl::unload_plugin(plugin_type_e _type) {
79 std::scoped_lock its_lock_start_stop{plugins_mutex_};
80 const auto found_handle = handles_.find(_type);
81 if (found_handle != handles_.end()) {
82 for (const auto& its_name : found_handle->second) {
83#ifdef _WIN32
84 FreeLibrary((HMODULE)its_name.second);
85#else
86 if (dlclose(its_name.second)) {
87 VSOMEIP_ERROR << "Unloading failed: (" << dlerror() << ")";
88 }
89#endif
90 }
91 } else {
92 VSOMEIP_ERROR << "plugin_manager_impl::unload_plugin didn't find plugin"
93 << " type:" << static_cast<int>(_type);
94 return false;
95 }
96 return plugins_.erase(_type);
97}
98
99void plugin_manager_impl::add_plugin(const std::shared_ptr<plugin>& _plugin, const std::string& _name) {
100 plugins_[_plugin->get_plugin_type()][_name] = _plugin;

Callers 1

Calls 1

endMethod · 0.80

Tested by

no test coverage detected