1
0

Fixed bug #385. UnloadUnusedChunks now has the same interface as

SaveAllChunks.  Meaning, QueueUnloadUnusedChunks and the supporting
cTaskUnloadUnusedChunks has been added.  Use QueueUnloadUnusedChunks from
now on to prevent deadlocking.
This commit is contained in:
narroo 2014-02-10 20:00:07 -05:00
parent 8028a8bbc6
commit e8e76a6058
3 changed files with 26 additions and 2 deletions

@ -1 +1 @@
Subproject commit 2cb1a0c4009ecf368ecc74eb428394e10f9e6d00
Subproject commit 2ceda579893ceb23c5eb0d56df47dc235644e0f4

View File

@ -2213,6 +2213,10 @@ void cWorld::UnloadUnusedChunks(void)
}
void cWorld::QueueUnloadUnusedChunks(void)
{
QueueTask(new cWorld::cTaskUnloadUnusedChunks);
}
@ -2966,7 +2970,13 @@ void cWorld::cTaskSaveAllChunks::Run(cWorld & a_World)
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cWorld::cTaskUnloadUnusedChunks
void cWorld::cTaskUnloadUnusedChunks::Run(cWorld & a_World)
{
a_World.UnloadUnusedChunks();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -99,6 +99,15 @@ public:
} ;
class cTaskUnloadUnusedChunks :
public cTask
{
protected:
// cTask overrides:
virtual void Run(cWorld & a_World) override;
};
static const char * GetClassStatic(void) // Needed for ManualBindings's ForEach templates
{
return "cWorld";
@ -243,7 +252,12 @@ public:
bool IsChunkValid (int a_ChunkX, int a_ChunkZ) const;
bool HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) const;
void UnloadUnusedChunks(void); // tolua_export
/*Unloads all chunks immediately. Dangerous interface, may deadlock, use QueueUnloadUnusedChunks() instead*/
void UnloadUnusedChunks(void);
/*Queues a task to unload unused chunks onto the tick thread. The prefferred way of unloading*/
void QueueUnloadUnusedChunks(void); // tolua_export
void CollectPickupsByPlayer(cPlayer * a_Player);