]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/FGTileLoader.hxx
Modified FlightGear/src/Scenery. The tile loader thread no longer adds
[flightgear.git] / src / Scenery / FGTileLoader.hxx
index f74ac3d16072e9ffdb9e698ddc8374eaa8b723d5..b5fb759c7474655836bc85b7e958e586507f5b38 100644 (file)
 #ifndef FG_TILE_LOADER_HXX
 #define FG_TILE_LOADER_HXX
 
-#include <queue>
-#include <pthread.h>
-
 #include <simgear/bucket/newbucket.hxx>
 #include <simgear/misc/sg_path.hxx>
 
 #ifdef ENABLE_THREADS
 #  include <simgear/threads/SGThread.hxx>
+#  include <simgear/threads/SGQueue.hxx>
 #endif
 
 // Forward reference.
@@ -61,11 +59,19 @@ public:
      */
     void add( FGTileEntry* tile );
 
+    /**
+     * The tile loader thread will only load one tile per call to the
+     * update() method.  This is a way to spread out the work of the
+     * tile loader and slow it down so it is less intrusive.  For
+     * systems built without thead support this is a no-op.
+     */
+    void update();
+
     /**
      * Returns whether the load queue is empty (contains no elements).
      * @return true if load queue is empty otherwise returns false.
      */
-    bool empty() const { return tile_queue.empty(); }
+    // bool empty() const { return tile_queue.empty(); }
 
 private:
 
@@ -74,8 +80,8 @@ private:
     /**
      * FIFO queue of tiles to load from data files.
      */
-    std::queue< FGTileEntry* > tile_queue;
-
+    SGBlockingQueue< FGTileEntry* > tile_queue;
+    
     /**
      * Base name of directory containing tile data file.
      */
@@ -123,7 +129,7 @@ private:
      * Lock and synchronize access to tile queue.
      */
     SGMutex mutex;
-    SGCondition cond;
+    SGCondition frame_cond;
 
     /**
      * Thread cleanup handler.