You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
781 B
C#

using System;
namespace LanLib.UpdateManager.Jobs
{
/// <summary>
/// Add this to a managed job struct type for setting its job batch size.
/// </summary>
/// <seealso cref="Unity.Jobs.IJobParallelForExtensions.Schedule"/>
/// <seealso cref="UnityEngine.Jobs.IJobParallelForTransformExtensions.ScheduleReadOnly"/>
[AttributeUsage(AttributeTargets.Struct)]
public class JobBatchSizeAttribute : Attribute
{
public int BatchSize { get; private set; }
public JobBatchSizeAttribute(int batchSize)
{
if (batchSize <= 0)
{
throw new ArgumentOutOfRangeException(nameof(batchSize), "Batch size must be a positive number");
}
BatchSize = batchSize;
}
}
}