Class BoundedParallelChunkProvider
Chunk provider handling requests in parallel, using a semaphore to limit the number of simultaneous generation tasks.
Implements
Inherited Members
Namespace: TerraProc.Core.Provider
Assembly: TerraProc.Core.dll
Syntax
public sealed class BoundedParallelChunkProvider : IChunkProvider
Constructors
| Edit this page View SourceBoundedParallelChunkProvider(ITerrainGenerator, int)
Chunk provider handling requests in parallel, using a semaphore to limit the number of simultaneous generation tasks.
Declaration
public BoundedParallelChunkProvider(ITerrainGenerator generator, int maxThreads)
Parameters
| Type | Name | Description |
|---|---|---|
| ITerrainGenerator | generator | Terrain generator to use for generating chunks. |
| int | maxThreads | Maximum number of parallel generation tasks. |
Methods
| Edit this page View SourceGetAsync(ChunkCoords, CancellationToken)
Gets the chunk data for the specified coordinates while respecting the parallelism limit.
Declaration
public Task<ChunkData> GetAsync(ChunkCoords coords, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ChunkCoords | coords | Coordinates of the chunk to retrieve. |
| CancellationToken | ct | Cancellation token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<ChunkData> | Chunk data. |