Changeset 20291

Show
Ignore:
Timestamp:
06/08/07 14:44:39 (1 year ago)
Author:
patrick
Message:

Fixed a potential mutex deadlock. To do this, I changed the pre-condition of
gadget::DeviceServer::debugDump() so that mClientsLock must be held prior to
calling this method. This is not exactly ideal, but the alternative is to
reduce the exception safety guarantee of gadget::DeviceServer::send(), and
that seems like a much worse scenario.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/branches/2.2/modules/gadgeteer/gadget/DeviceServer.cpp

    r19729 r20291  
    162162   void DeviceServer::debugDump(int debugLevel) 
    163163   { 
    164       vpr::Guard<vpr::Mutex> guard(mClientsLock); 
     164      vprASSERT(mClientsLock.test() && 
     165                "mClientsLock must be locked by the caller"); 
    165166 
    166167      vpr::DebugOutputGuard dbg_output( 
  • juggler/branches/2.2/modules/gadgeteer/gadget/DeviceServer.h

    r19729 r20291  
    6565      void removeClient(const std::string& host_name); 
    6666 
    67       void debugDump(int debug_level); 
     67      /** 
     68       * Dumps the state of the clients as debug output. 
     69       * 
     70       * @pre \c mClientsLock is locked by the calling thread. 
     71       * 
     72       * @param debugLevel The debug output level to use for the output. 
     73       * 
     74       * @see lockClients() 
     75       * @see unlockClients() 
     76       */ 
     77      void debugDump(int debugLevel); 
    6878 
    6979      std::string getName() { return mName; } 
  • juggler/branches/2.2/modules/gadgeteer/gadget/RemoteInputManager.cpp

    r20200 r20291  
    449449      for ( std::vector<DeviceServer*>::iterator j = mDeviceServers.begin(); j != mDeviceServers.end(); j++ ) 
    450450      { 
     451         (*j)->lockClients(); 
    451452         (*j)->debugDump(debug_level); 
     453         (*j)->unlockClients(); 
    452454      } 
    453455   }