All pastes #146053 Raw Edit

Unnamed

public text v1 · immutable
#146053 ·published 2006-08-23 09:32 UTC
rendered paste body
namespace NMM {

ClientRegistry::ClientRegistry()
  : NamedObject("ClientRegistry"), __is_running(true), __init_transaction(false), __condition(__condition_mutex), __time_interval(5), __member_mutex(ThreadMutex::RECURSIVE)
{
  /* Stores a pointer to the PluginManager in this address space. This is need for
   * local optimization
   */
 /* __internal_p_manager.reset(SPluginManager::getInstance().getInterface<IPluginManager>());*/
  NMMObject* tmp_object =
 dynamic_cast<NMMObject*>(&SPluginManager::getInstance());
__internal_p_manager.reset(tmp_object->getInterface<IPluginManager>());
  /* start the thread to refresh ressource reservation */
  activateThread();
}

ClientRegistry::~ClientRegistry() {
  /* Begin> Deactivate the thread*/
  __condition_mutex.lock();
  __is_running = false;                 // set the running flag to false
  __condition.notify();                 // and notify the thread
  __condition_mutex.unlock();
  deactivateThread();                   // wait until thread terminates
  /* End< */

  /* Begin> delete the interfaces the ClientRegistry use*/
  for (RegistryIt it = __named_registry.begin(); it != __named_registry.end(); ++it) {
    delete it->second.server_registry;  //delete the IServerRegistry
    delete it->second.plugin_manager;   //delete the corresponding IPluginManager
  }
  /* End < */
}