Skip to content

Class JobSystem

Namespace: Apogee.Core.Concurrency
Assembly: Apogee.Core.dll

A fixed pool of worker threads that runs jobs in the order they were scheduled.

public sealed class JobSystem : IDisposable

Inheritance

object ← JobSystem

Implements

IDisposable

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

JobSystem(int)

public JobSystem(int workerCount = 0)

Parameters

workerCount int

Number of threads; by default one fewer than the logical processors (the caller's thread is the other).

Properties

WorkerCount

public int WorkerCount { get; }

Property Value

int

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

ParallelFor(int, int, Action<int, int>)

Runs body over [0, count) in batches, and returns when all of it has run.

public void ParallelFor(int count, int batchSize, Action<int, int> body)

Parameters

count int

batchSize int

body Action<int, int>

Receives the start (inclusive) and end (exclusive) of one batch.

Schedule(JobGroup, Action)

public void Schedule(JobGroup group, Action job)

Parameters

group JobGroup

job Action