Vixen
dd8b0a81
csharp
public sealed class JobAccess

What a job reads and what it writes, as opaque resource ids — the declaration the safety system checks concurrent jobs against.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The ids mean nothing here. This assembly cannot know what a resource is; the one consumer that does is the ECS, which passes ComponentTypeId.Value. Any other producer of declarations only has to agree with itself on a numbering — two subsystems numbering different things the same way would report conflicts that are not there, which is why the numbering belongs to one registry rather than to each caller.

A write implies a read. Otherwise a job that only writes X and one that only reads X would look disjoint, which is the one combination that is definitely a race. Reads therefore always contains Writes.

⚠ None and Everything are not opposites. None means undeclared — the scheduler has nothing to check and skips the job entirely, which is what every job outside the ECS is. Everything means declared, and touching all of it, so it conflicts with every other declared job. The ECS maps an undeclared system onto Everything, because "I did not say" already means "conflicts with everything" there; a texture decode that never declared anything maps onto None and is not policed against it.

Fields and properties (6)

  • public static JobAccess None

    Nothing declared, so nothing is checked. What every job has unless one is declared.

  • public static JobAccess Everything

    Declared as touching everything, so it conflicts with every other declared job.

  • public IReadOnlyList<int> Reads

    The resource ids read, including the ones written, ascending.

  • public IReadOnlyList<int> Writes

    The resource ids written, ascending.

  • public bool IsEverything

    Whether this declares that it touches everything.

  • public bool IsUndeclared

    Whether this declares nothing, and so is not checked at all.

Methods (3)

  • public JobAccess(ReadOnlySpan<int> reads, ReadOnlySpan<int> writes)

    Builds a declaration.

  • public bool ConflictsWith(JobAccess other)

    Whether two jobs that ran at the same time would race.

  • public override string ToString()

    Renders the two sets, which is what the safety system's message shows.

Used by (6)

  • InferredSystemAccessTestsVixen.Engine.Tests
  • JobAccessScopeVixen.Core.Threading
  • JobAccessTestsVixen.Core.Threading.Tests
  • JobSchedulerVixen.Core.Threading
  • SystemAccessVixen.Ecs
  • SystemAccessSafetyTestsVixen.Ecs.Tests