#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.
*/
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:
/**
* 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.
*/
* Lock and synchronize access to tile queue.
*/
SGMutex mutex;
- SGCondition cond;
+ SGCondition frame_cond;
/**
* Thread cleanup handler.