How to wait for all processes to exit

I created many processes, and how to quit after the main process waits for all processes to be executed.

Now I use Process.sleep(60000)

It seems Tasks can help You. You can start many tasks and await for them to finish their work.

Put your processes under a supervisor in your app’s supervision tree, it will wait for them to finish (up to a configurable limit) before shutting down.

If you use tasks this is easy to do with Task.Supervisor.

thanks