| 76 | } |
| 77 | |
| 78 | bool 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 | |
| 99 | void plugin_manager_impl::add_plugin(const std::shared_ptr<plugin>& _plugin, const std::string& _name) { |
| 100 | plugins_[_plugin->get_plugin_type()][_name] = _plugin; |
no test coverage detected