_dt( 0.0 ),
_error_dt( 0.0 )
{
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
thread = new MetarThread(this);
thread->start( 1 );
#endif // ENABLE_THREADS
FGMetarEnvironmentCtrl::~FGMetarEnvironmentCtrl ()
{
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
thread->cancel();
thread->join();
#endif // ENABLE_THREADS
}
}
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if !defined(ENABLE_THREADS)
// No loader thread running so manually fetch the data
string id = "";
while ( !request_queue.empty() ) {
} catch (const sg_io_exception& e) {
SG_LOG( SG_GENERAL, SG_WARN, "Error fetching live weather data: "
<< e.getFormattedMessage().c_str() );
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
if (_error_count++ >= 3) {
SG_LOG( SG_GENERAL, SG_WARN, "Stop fetching data permanently.");
thread->cancel();
}
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
/**
*
*/
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/environment/metar.hxx>
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
# include <simgear/threads/SGThread.hxx>
# include <simgear/threads/SGQueue.hxx>
#endif
private:
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
/**
* FIFO queue which holds a pointer to the fetched metar data.
*/
queue < FGMetarResult > result_queue;
#endif
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
/**
* This class represents the thread of execution responsible for
* fetching the metar data.
*/
FGTileLoader::FGTileLoader()
{
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
// Create and start the loader threads.
for (int i = 0; i < MAX_THREADS; ++i)
{
*/
FGTileLoader::~FGTileLoader()
{
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
// Wake up its time to die.
// queue_cond.broadcast();
FGTileLoader::update()
{
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
// send a signal to the pager thread that it is allowed to load
// another tile
mutex.lock();
}
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
/**
*
*/
#include <simgear/bucket/newbucket.hxx>
#include <simgear/misc/sg_path.hxx>
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
# include <simgear/threads/SGThread.hxx>
# include <simgear/threads/SGQueue.hxx>
#else
private:
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
/**
* FIFO queue of tiles to load from data files.
*/
*/
string_list tile_path;
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
/**
* Maximum number of threads to create for loading tiles.
*/
#define TEST_LAST_HIT_CACHE
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
SGLockedQueue<FGTileEntry *> FGTileMgr::attach_queue;
SGLockedQueue<FGDeferredModel *> FGTileMgr::model_queue;
#else
}
while ( ! model_queue.empty() ) {
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
FGDeferredModel* dm = model_queue.pop();
#else
FGDeferredModel* dm = model_queue.front();
// cout << "loading next model ..." << endl;
// load the next tile in the queue
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
FGDeferredModel* dm = model_queue.pop();
#else
FGDeferredModel* dm = model_queue.front();
loader.update();
if ( !attach_queue.empty() ) {
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
FGTileEntry* e = attach_queue.pop();
#else
FGTileEntry* e = attach_queue.front();
// get real serious and agressively free up some tiles so
// we don't explode our memory usage.
- SG_LOG( SG_TERRAIN, SG_WARN,
+ SG_LOG( SG_TERRAIN, SG_ALERT,
"Warning: catching up on tile delete queue" );
}
#include <queue>
#include <simgear/bucket/newbucket.hxx>
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
# include <simgear/threads/SGQueue.hxx>
#endif // ENABLE_THREADS
* model_queue is the set of models that need to be loaded by the
* primary render thread.
*/
-#if defined(ENABLE_THREADS) && ENABLE_THREADS
+#if defined(ENABLE_THREADS)
static SGLockedQueue<FGTileEntry *> attach_queue;
static SGLockedQueue<FGDeferredModel *> model_queue;
#else