I have a long running task (250ms+)that I want to pick up a resultant array from. This job is a path finding service that should run periodically in the background. It's all prototyped in another language using a background Thread.
According to the Unity docs, I should call Complete() when I'm ready for the results of this job. However, I don't know when this task will complete - I don't want my main thread to wait on this job completing. I want this job to run async and to collect the result from a Nativearray:
- the resultant search array
null (if it's a first run and still in process.
- with concurrent array access protected by a lock. If the job is writing to the array, it should be locked.
What's confusing is that most of the Unity job examples seem to use short jobs that last a few frames, then pick up a result in a LateUpdate() or next Update(). My job is much longer running. Since my job uses no Unity API directly, am I correct that standard c# Threads seem more applicable for my kind of problem?