Limit to one instance of the application


Is there a built-in way to limit the system to only having a single instance of the Panda3D application running?

I was considering just having the application make a file during startup and then get rid of it during termination. Every other potential instance would check if that file exists and either terminate (if it does) or continue running otherwise. I would be concerned that if an application crashes, this could be thrown off.

Is there anything better to handle this?



There’s nothing built-in to Panda to handle this.

Most people solve this problem by using explicit operating-system support, direct calls into the operating system to check for a window class or instance class or something. Of course this means you sacrifice portability unless you write your code to check what kind of operating system you’re on first and do the appropriate thing for each one.



Thanks for the reply. We can change our code to check executing processes. Good idea. Thanks again!