Class JobSystem
Lightweight multi-threaded jobs execution scheduler. Uses a pool of threads and supports work-stealing concept.
Inheritance
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public static class JobSystem : Object
Properties
ThreadsCount
Gets the amount of job system threads.
Declaration
[Unmanaged]
public static int ThreadsCount { get; }
Property Value
System.Int32
|
Methods
Dispatch(JobSystem.Delegate0, Int32)
Dispatches the job for the execution.
Declaration
[Unmanaged]
public static long Dispatch(JobSystem.Delegate0 job, int jobCount = 1)
Parameters
JobSystem.Delegate0
job
The job. Argument is an index of the job execution. |
System.Int32
jobCount
The job executions count. |
Returns
System.Int64
The label identifying this dispatch. Can be used to wait for the execution end. |
Dispatch(JobSystem.Delegate0, Int64[], Int32)
Dispatches the job for the execution after all of dependant jobs will complete.
Declaration
[Unmanaged]
public static long Dispatch(JobSystem.Delegate0 job, long[] dependencies, int jobCount = 1)
Parameters
JobSystem.Delegate0
job
The job. Argument is an index of the job execution. |
System.Int64[]
dependencies
The list of dependant jobs that need to complete in order to start executing this job. |
System.Int32
jobCount
The job executions count. |
Returns
System.Int64
The label identifying this dispatch. Can be used to wait for the execution end. |
Execute(JobSystem.Delegate0, Int32)
Executes the job (utility to call dispatch and wait for the end).
Declaration
[Unmanaged]
public static void Execute(JobSystem.Delegate0 job, int jobCount = 1)
Parameters
JobSystem.Delegate0
job
The job. Argument is an index of the job execution. |
System.Int32
jobCount
The job executions count. |
SetJobStartingOnDispatch(Boolean)
Sets whether automatically start jobs execution on Dispatch. If disabled jobs won't be executed until it gets re-enabled. Can be used to optimize execution of multiple dispatches that should overlap.
Declaration
[Unmanaged]
public static void SetJobStartingOnDispatch(bool value)
Parameters
System.Boolean
value
|
Wait()
Waits for all dispatched jobs to finish.
Declaration
[Unmanaged]
public static void Wait()
Wait(Int64)
Waits for all dispatched jobs until a given label to finish (i.e. waits for a Dispatch that returned that label).
Declaration
[Unmanaged]
public static void Wait(long label)
Parameters
System.Int64
label
The label. |