Skip to main content

ChunkThread

A class in Root.Township, Alta.Caves.

Runs a cave MapChunk's generation on its own background thread. MapChunk makes one and polls IsComplete.

Constructors​

MemberWhat it is
ChunkThread(MapChunk chunk)Creates a ChunkThread from chunk.

Fields​

4 private and internal fields
MemberWhat it is
private MapChunk chunkPrivate: the chunk being generated.
private Thread generationThreadPrivate: the worker thread.
private bool isCompleteBacking field for IsComplete.
private object lockObjectPrivate: lock guarding isComplete.

Properties​

MemberWhat it is
bool IsComplete { get; set; }Whether generation has finished. Locked so the main thread can read it safely.

Methods​

MemberWhat it is
void Abort()Aborts the generation thread.
void Generate()Runs every generator plugin on the chunk, builds its non zero lists and sets IsComplete. Runs on the worker thread.
void StartGenerating()Prepares the chunk on the calling thread, then starts Generate on a new thread.

Used in​

Members of other types that take, return or hold a ChunkThread: