# Schedule

> Schedule the job for execution on worker threads. list.Length is used as the iteration count. Note that it is required to embed the list on the job struct as well.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Jobs](/engine/6000.7/script-reference/unity/jobs.md)
* **Assembly:** UnityEngine.ManagedKernelModule

## Schedule\<T, U>(T, NativeList\<T>, int, JobHandle)

Schedule the job for execution on worker threads. list.Length is used as the iteration count. Note that it is required to embed the list on the job struct as well.

```csharp
public static JobHandle Schedule<T, U>(this T jobData, NativeList<U> list, int innerloopBatchCount, JobHandle dependsOn = default) where T : struct, IJobParallelForDefer where U : unmanaged
```

### Parameters

**** (T): The job and data to schedule.**** (\[NativeList\<T>]\(/engine/6000.7/script-reference/unity/collections/nativelist1)): list.Length is used as the iteration count.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Granularity in which workstealing is performed. A value of 32, means the job queue will steal 32 iterations and then perform them in an efficient inner loop.**** (\[JobHandle]\(/engine/6000.7/script-reference/unity/jobs/jobhandle)): Dependencies are used to ensure that a job executes on workerthreads after the dependency has completed execution. Making sure that two jobs reading or writing to same data do not run in parallel.

### Returns

| Type                                                                 | Description                                                                                                                              |
| -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| [JobHandle](/engine/6000.7/script-reference/unity/jobs/jobhandle.md) | JobHandle The handle identifying the scheduled job. Can be used as a dependency for a later job or ensure completion on the main thread. |

## Schedule\<T>(T, int\*, int, JobHandle)

Schedule the job for execution on worker threads. forEachCount is a pointer to the number of iterations, when dependsOn has completed. This API is unsafe, it is recommended to use the NativeList based Schedule method instead.

```csharp
public static JobHandle Schedule<T>(this T jobData, int* forEachCount, int innerloopBatchCount, JobHandle dependsOn = default) where T : struct, IJobParallelForDefer
```

### Parameters

**** (T): The job and data to schedule.**** (\[int\*]\(https\://learn.microsoft.com/dotnet/api/system.int32)): \*forEachCount is used as the iteration count.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Granularity in which workstealing is performed. A value of 32, means the job queue will steal 32 iterations and then perform them in an efficient inner loop.**** (\[JobHandle]\(/engine/6000.7/script-reference/unity/jobs/jobhandle)): Dependencies are used to ensure that a job executes on workerthreads after the dependency has completed execution. Making sure that two jobs reading or writing to same data do not run in parallel.

### Returns

| Type                                                                 | Description |
| -------------------------------------------------------------------- | ----------- |
| [JobHandle](/engine/6000.7/script-reference/unity/jobs/jobhandle.md) |             |
