Associating NativeArray with a Job manually

I am running a job, which (for some reasons) accesses a NativeArray through a pointer. Therefore, the safety system is unaware of the job accessing the array, which is what I am trying to fix. Is there some intended way to achieve this? I was looking into AtomicSafetyHandle, but can’t see anything relevant. I’d expect some method that tells the array/safety handle to disallow access until some JobHandle has completed.

Currently, I have an idea for a workaround, to schedule a separate dummy job (that claims the disputed array) and schedule it with a dependency on the unsafe job. Is this sufficient?

I am running a job, which (for some reasons) accesses a NativeArray through a pointer.
NativeArray is a pointer :T

A humble pointer in a fancy clothes.
_

I’d expect some method that tells the array/safety handle to disallow access until some JobHandle has completed.

This method exists - it’s not part of the NativeArray/Unity.Collections but Unity.Jobs. It’s Schedule ( JobHandle dependency ) which you mentioned.
_

Currently, I have an idea for a workaround, to schedule a separate dummy job (that claims the disputed array) and schedule it with a dependency on the unsafe job. Is this sufficient?

Dependency chain is confusing at first, but you will get the hang of it eventually.

You didn’t describe the specific situation in great detail here but if by any chance you’re scheduling the same job every frame and this job accesses the same NativeArray allocation then this job should include it’s own job handle as dependency.