Revision: 7545
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7545&view=rev
Author:   rtv
Date:     2009-03-25 17:56:06 +0000 (Wed, 25 Mar 2009)

Log Message:
-----------
made update callbacks thread safe, added Model::GetId() and disabled 
wavefront-based fasr_plan demo

Modified Paths:
--------------
    code/stage/trunk/examples/ctrl/CMakeLists.txt
    code/stage/trunk/libstage/model.cc
    code/stage/trunk/libstage/model_getset.cc
    code/stage/trunk/libstage/stage.hh
    code/stage/trunk/libstage/world.cc
    code/stage/trunk/worlds/fasr.world

Modified: code/stage/trunk/examples/ctrl/CMakeLists.txt
===================================================================
--- code/stage/trunk/examples/ctrl/CMakeLists.txt       2009-03-25 17:31:27 UTC 
(rev 7544)
+++ code/stage/trunk/examples/ctrl/CMakeLists.txt       2009-03-25 17:56:06 UTC 
(rev 7545)
@@ -8,9 +8,9 @@
 )
 
 # need plaer's wavefront planning library for this one
-if( PLAYER_FOUND )  
-  SET( PLUGINS ${PLUGINS} fasr_plan )
-endif( PLAYER_FOUND )
+#if( PLAYER_FOUND )  
+#  SET( PLUGINS ${PLUGINS} fasr_plan )
+#endif( PLAYER_FOUND )
 
 # create a library module for each plugin and link libstage to each
 

Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc  2009-03-25 17:31:27 UTC (rev 7544)
+++ code/stage/trunk/libstage/model.cc  2009-03-25 17:56:06 UTC (rev 7545)
@@ -665,7 +665,10 @@
 void Model::UpdateIfDue( void )
 {
   if( UpdateDue() )
-    Update();
+        {
+               Update();
+               CallUpdateCallbacks();
+        }
 }
   
 bool Model::UpdateDue( void )
@@ -699,11 +702,16 @@
       */      
     }
   
+  //CallCallbacks( &hooks.update );
+  //last_update = world->sim_time;
+}
+
+void Model::CallUpdateCallbacks( void )
+{
   CallCallbacks( &hooks.update );
   last_update = world->sim_time;
 }
 
-
 stg_meters_t Model::ModelHeight()
 {      
   stg_meters_t m_child = 0; //max size of any child

Modified: code/stage/trunk/libstage/model_getset.cc
===================================================================
--- code/stage/trunk/libstage/model_getset.cc   2009-03-25 17:31:27 UTC (rev 
7544)
+++ code/stage/trunk/libstage/model_getset.cc   2009-03-25 17:56:06 UTC (rev 
7545)
@@ -1,6 +1,7 @@
 #include "stage.hh"
 using namespace Stg;
 
+
 void Model::SetGeom( Geom geom )
 {
   UnMapWithChildren();

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2009-03-25 17:31:27 UTC (rev 7544)
+++ code/stage/trunk/libstage/stage.hh  2009-03-25 17:56:06 UTC (rev 7545)
@@ -1720,7 +1720,8 @@
 
         bool UpdateDue( void );
         void UpdateIfDue();
-  
+        void CallUpdateCallbacks( void );
+
         void DrawBlocksTree();
         virtual void DrawBlocks();
         void DrawBoundingBox();
@@ -1938,7 +1939,10 @@
         void SetFiducialKey(  int key );
        
         stg_color_t GetColor(){ return color; }
-       
+        
+        /** return a model's unique process-wide identifier */
+        uint32_t GetId() { return id; }
+        
         //  stg_laser_return_t GetLaserReturn(){ return laser_return; }
        
         /** Change a model's parent - experimental*/

Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc  2009-03-25 17:31:27 UTC (rev 7544)
+++ code/stage/trunk/libstage/world.cc  2009-03-25 17:56:06 UTC (rev 7545)
@@ -475,6 +475,9 @@
       while( update_jobs_pending )
                  g_cond_wait( worker_threads_done, thread_mutex );
       g_mutex_unlock( thread_mutex );           
+
+               // now call all the callbacks - ignores dueness, but not a big 
deal
+      LISTMETHOD( reentrant_update_list, Model*, CallUpdateCallbacks );
     }
   
   this->sim_time += this->interval_sim;

Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world  2009-03-25 17:31:27 UTC (rev 7544)
+++ code/stage/trunk/worlds/fasr.world  2009-03-25 17:56:06 UTC (rev 7545)
@@ -13,8 +13,8 @@
 resolution 0.02
 
 # threads may speed things up here depending on available CPU cores & workload 
-# threadpool 8 
- threadpool 0
+ threadpool 8 
+# threadpool 0
 
 
 # configure the GUI window


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