Write a program that will:
- Wait for the completion of your application.
- Run it again.
Call this program and then exit the application. This solution is widely used.
Another option:
Call your application with a specific parameter (e.g. / restarted). The new instance must wait for the old to complete before completing any tasks. Then turn off the old instance.
source share