Revision: 7441
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7441&view=rev
Author:   gerkey
Date:     2009-03-10 08:52:48 +0000 (Tue, 10 Mar 2009)

Log Message:
-----------
working on createmodel hanging problem

Modified Paths:
--------------
    code/branches/federation/gazebo/webgazebo/WebGazebo.cc

Modified: code/branches/federation/gazebo/webgazebo/WebGazebo.cc
===================================================================
--- code/branches/federation/gazebo/webgazebo/WebGazebo.cc      2009-03-10 
08:35:43 UTC (rev 7440)
+++ code/branches/federation/gazebo/webgazebo/WebGazebo.cc      2009-03-10 
08:52:48 UTC (rev 7441)
@@ -229,40 +229,43 @@
   if(!GetModel(name,type,xmldata,response))
     return false;
 
-  struct timespec sleeptime = {0, 10000000};
+  struct timespec sleeptime = {0, 100000000};
   for(;;)
   {
     this->factoryIface->Lock(1);
     if(!strcmp((const char*)this->factoryIface->data->newModel,""))
     {
       strcpy((char*)this->factoryIface->data->newModel, xmldata.c_str());
-      factoryIface->Unlock();
-      
-      // Now, wait until Gazebo has consumed the new model
-      for(;;)
-      {
-        this->factoryIface->Lock(1);
-        if(!strcmp((const char*)this->factoryIface->data->newModel,""))
-        {
-          factoryIface->Unlock();
-          break;
-        }
-        else
-        {
-          factoryIface->Unlock();
-          nanosleep(&sleeptime, NULL);
-        }
-      }
+      this->factoryIface->Unlock();
+      break;
+    }
+    else
+    {
+      this->factoryIface->Unlock();
+      nanosleep(&sleeptime, NULL);
+    }
+  }
 
-      response = std::string("Created model ") + name + " of type " + type;
-      return true;
+  /*
+  // Now, wait until Gazebo has consumed the new model
+  for(;;)
+  {
+    this->factoryIface->Lock(1);
+    if(!strcmp((const char*)this->factoryIface->data->newModel,""))
+    {
+      this->factoryIface->Unlock();
+      break;
     }
     else
     {
-      factoryIface->Unlock();
+      this->factoryIface->Unlock();
       nanosleep(&sleeptime, NULL);
     }
   }
+  */
+
+  response = std::string("Created model ") + name + " of type " + type;
+  return true;
 }
 
 bool


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to