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:
parent
8028a8bbc6
commit
e8e76a6058
@ -1 +1 @@
|
||||
Subproject commit 2cb1a0c4009ecf368ecc74eb428394e10f9e6d00
|
||||
Subproject commit 2ceda579893ceb23c5eb0d56df47dc235644e0f4
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
16
src/World.h
16
src/World.h
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user