I don‘t understand what you want to achieve and what you mean by main thread waiting for completion?
If a job takes a long time, let‘s say one second, it‘s not going to affect the main thread in any way - unless you call JobHandle.Complete() at which point the main thread is blocked and the next frame will be rendered after about one second.
If you want a long-running background task on one thread only you can use a regular IJob with a loop. Or several, each getting a slice of the array they should work on.
Thanks for your advice! This was what I expected, and everything worked fine with non-ParallelFor jobs. However, it seems some rendering jobs must be done by job workers. When all job workers are busy working on a ParallelFor job, the main thread has to wait for its completion.
I am wondering if we can limit the number of worker used by a ParallelFor job, and reserve some workers for other system jobs(rendering, etc.).