Limit to one instance of the application

Return to General Discussion

Limit to one instance of the application

Postby hannamj1 » Sat Feb 11, 2012 3:43 pm

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?

Thanks!
hannamj1
 
Posts: 10
Joined: Mon Aug 22, 2011 10:55 am

Postby drwr » Sat Feb 11, 2012 4:05 pm

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.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby hannamj1 » Sat Feb 11, 2012 6:25 pm

Thanks for the reply. We can change our code to check executing processes. Good idea. Thanks again!
hannamj1
 
Posts: 10
Joined: Mon Aug 22, 2011 10:55 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest