Changeset 19633

Show
Ignore:
Timestamp:
12/11/06 19:53:38 (2 years ago)
Author:
aronb
Message:

Add code to allow shutdown of ConfigManager? and InputManager?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/gadgeteer/gadget/InputManager.cpp

    r19603 r19633  
    7979InputManager::~InputManager() 
    8080{ 
     81   shutdown(); 
     82} 
     83 
     84void InputManager::shutdown() 
     85{ 
    8186   for (tDevTableType::iterator a = mDevTable.begin(); a != mDevTable.end(); ++a)    // Stop all devices 
    8287   { 
     
    273278      updateAllDevices();                             // Update all the input data 
    274279      updateAllProxies();                             // Update all the input data 
    275       BaseDeviceInterface::refreshAllDevices();      // Refresh all the device interface handles 
     280      BaseDeviceInterface::refreshAllInterfaces();    // Refresh all the device interface handles 
    276281      vprDEBUG(gadgetDBG_INPUT_MGR,vprDBG_STATE_LVL) 
    277282         << "Updated all devices" << std::endl << vprDEBUG_FLUSH; 
     
    330335      updateAllDevices();                             // Update all the input data 
    331336      updateAllProxies();                             // Update all the input data 
    332       BaseDeviceInterface::refreshAllDevices();      // Refresh all the device interface handles 
     337      BaseDeviceInterface::refreshAllInterfaces();      // Refresh all the device interface handles 
    333338      vprDEBUG(gadgetDBG_INPUT_MGR,vprDBG_VERB_LVL) 
    334339         << "InputManager::configRemove(): Updated all data" << std::endl 
  • juggler/trunk/modules/gadgeteer/gadget/InputManager.h

    r19603 r19633  
    126126   bool configureDevice(jccl::ConfigElementPtr element); 
    127127 
     128   /** 
     129    * Shutdown all devices and proxies. 
     130    */ 
     131   void shutdown(); 
    128132private: 
    129133   /** 
  • juggler/trunk/modules/gadgeteer/gadget/Type/DeviceInterface.cpp

    r18824 r19633  
    143143} 
    144144 
    145 void BaseDeviceInterface::refreshAllDevices() 
     145void BaseDeviceInterface::refreshAllInterfaces() 
    146146{ 
    147147   for ( unsigned int i = 0; i < mAllocatedDevices.size(); ++i ) 
  • juggler/trunk/modules/gadgeteer/gadget/Type/DeviceInterface.h

    r18824 r19633  
    7777    * Refreshes the interface based on the current configuration. 
    7878    * 
    79     * This method is called by refreshAllDevices when system 
     79    * This method is called by refreshAllInterfaces when system 
    8080    * @post (mProxyIndex == -1) ==> Proxy not initialized yet.<br> 
    8181    *       (mProxyIndex != -1) ==> mProxyName has name of device && local 
     
    103103public: 
    104104   /** Refreshes all the known device interface objects. */ 
    105    static void refreshAllDevices(); 
     105   static void refreshAllInterfaces(); 
    106106 
    107107private:    // Static information 
  • juggler/trunk/modules/jackal/rtrc/jccl/RTRC/ConfigManager.cpp

    r19490 r19633  
    743743} 
    744744 
     745void ConfigManager::shutdown(bool attemptRemoval) 
     746{ 
     747   // Attempt to remove configutation elements 
     748   // the "correct" way. 
     749   if (attemptRemoval) 
     750   { 
     751      mActiveLock.acquire(); 
     752      addConfigurationRemovals(&mActiveConfig); 
     753      mActiveLock.release(); 
     754 
     755      unsigned num_processed(0); 
     756 
     757      do 
     758      { 
     759         num_processed = attemptReconfiguration(); 
     760      } 
     761      while (num_processed > 0); 
     762   } 
     763 
     764   // Clear all pending configuration elements. 
     765   mPendingLock.acquire(); 
     766   mPendingConfig.clear(); 
     767   mPendingLock.release(); 
     768 
     769   // Clear all active configuration elements. 
     770   mActiveLock.acquire(); 
     771   mActiveConfig.vec().clear(); 
     772   mActiveConfig = Configuration(); 
     773   mActiveLock.release(); 
     774 
     775   // Clear all incoming configuration elements. 
     776   mIncomingLock.acquire(); 
     777   mIncomingConfig.clear(); 
     778   mIncomingLock.release(); 
     779 
     780   // Clear all element handlers. 
     781   mElementHandlers.clear(); 
     782 
     783   // Reset all count values. 
     784   mPendingCountMutex.acquire(); 
     785   mPendingCheckCount = 0; 
     786   mLastPendingSize = 0; 
     787   mPendingCountMutex.release(); 
     788} 
     789 
    745790int ConfigManager::attemptReconfiguration() 
    746791{ 
  • juggler/trunk/modules/jackal/rtrc/jccl/RTRC/ConfigManager.h

    r19281 r19633  
    436436   //@} 
    437437 
     438   /** 
     439    * Shutdown the Configuration system. Removes all new, pending, and active 
     440    * configuration elements. 
     441    * 
     442    * @param attemptRemoval If true, add all active ConfigElements as removals 
     443    *                       and attempt to reconfig. 
     444    */ 
     445   void shutdown(bool attemptRemoval = false); 
     446 
    438447   void setRemoteReconfigPlugin(jccl::RemoteReconfig* plugin); 
    439448