diff --git a/src/Scenery/FGTileLoader.cxx b/src/Scenery/FGTileLoader.cxx index 8f04c78c8..661833e28 100644 --- a/src/Scenery/FGTileLoader.cxx +++ b/src/Scenery/FGTileLoader.cxx @@ -89,6 +89,7 @@ FGTileLoader::add( FGTileEntry* tile ) tile_load_queue.push( tile ); } +#ifdef WISH_PLIB_WAS_THREADED // but it isn't /** * */ @@ -97,6 +98,7 @@ FGTileLoader::remove( FGTileEntry* tile ) { tile_free_queue.push( tile ); } +#endif /** * @@ -156,6 +158,7 @@ FGTileLoader::LoaderThread::run() FGTileMgr::ready_to_attach( tile ); +#ifdef WISH_PLIB_WAS_THREADED // but it isn't // Handle and pending removals while ( !loader->tile_free_queue.empty() ) { cout << "freeing next tile ..." << endl; @@ -164,6 +167,8 @@ FGTileLoader::LoaderThread::run() tile->free_tile(); delete tile; } +#endif + } pthread_cleanup_pop(1); } diff --git a/src/Scenery/FGTileLoader.hxx b/src/Scenery/FGTileLoader.hxx index 258232a52..f8d1ba03b 100644 --- a/src/Scenery/FGTileLoader.hxx +++ b/src/Scenery/FGTileLoader.hxx @@ -60,11 +60,13 @@ public: */ void add( FGTileEntry* tile ); +#ifdef WISH_PLIB_WAS_THREADED // but it isn't /** * Remove a tile from memory. * @param tile The tile to be removed from memory. */ void remove( FGTileEntry* tile ); +#endif /** * The tile loader thread will only load one tile per call to the @@ -89,10 +91,10 @@ private: * FIFO queue of tiles to load from data files. */ SGBlockingQueue< FGTileEntry * > tile_load_queue; - SGBlockingQueue< FGTileEntry * > tile_free_queue; + // SGBlockingQueue< FGTileEntry * > tile_free_queue; #else queue< FGTileEntry * > tile_load_queue; - queue< FGTileEntry * > tile_free_queue; + // queue< FGTileEntry * > tile_free_queue; #endif /** diff --git a/src/Scenery/newcache.cxx b/src/Scenery/newcache.cxx index c7e59195e..841fb4bac 100644 --- a/src/Scenery/newcache.cxx +++ b/src/Scenery/newcache.cxx @@ -64,9 +64,10 @@ void FGNewCache::entry_free( long cache_index ) { SG_LOG( SG_TERRAIN, SG_DEBUG, "FREEING CACHE ENTRY = " << cache_index ); FGTileEntry *tile = tile_cache[cache_index]; tile->disconnect_ssg_nodes(); - tile->sched_removal(); -#if 0 +#ifdef WISH_PLIB_WAS_THREADED + tile->sched_removal(); +#else // plib isn't threaded so we always go here tile->free_tile(); delete tile; #endif diff --git a/src/Scenery/tileentry.cxx b/src/Scenery/tileentry.cxx index 4bc931ae1..5ba0900d8 100644 --- a/src/Scenery/tileentry.cxx +++ b/src/Scenery/tileentry.cxx @@ -105,11 +105,15 @@ static void my_remove_branch( ssgBranch * branch ) { } +#ifdef WISH_PLIB_WAS_THREADED // but it isn't + // Schedule tile to be freed/removed void FGTileEntry::sched_removal() { global_tile_mgr.ready_to_delete( this ); } +#endif + // Clean up the memory used by this tile and delete the arrays used by // ssg as well as the whole ssg branch diff --git a/src/Scenery/tileentry.hxx b/src/Scenery/tileentry.hxx index 5199f8f92..d1fdb93e2 100644 --- a/src/Scenery/tileentry.hxx +++ b/src/Scenery/tileentry.hxx @@ -177,8 +177,10 @@ public: // Destructor ~FGTileEntry(); +#ifdef WISH_PLIB_WAS_THREADED // but it isn't // Schedule tile to be freed/removed void sched_removal(); +#endif // Clean up the memory used by this tile and delete the arrays // used by ssg as well as the whole ssg branch diff --git a/src/Scenery/tilemgr.hxx b/src/Scenery/tilemgr.hxx index 0dfc968ed..b4ae8ac1d 100644 --- a/src/Scenery/tilemgr.hxx +++ b/src/Scenery/tilemgr.hxx @@ -143,10 +143,12 @@ public: */ static void ready_to_attach( FGTileEntry *t ) { attach_queue.push( t ); } +#ifdef WISH_PLIB_WAS_THREADED // but it isn't /** * Tile is detatched from scene graph and is ready to delete */ inline void ready_to_delete( FGTileEntry *t ) { loader.remove( t ); } +#endif /** * Add a pending model to the 'deferred model load' queue