• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Single Instance of a Cocoa Application.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Single Instance of a Cocoa Application.


  • Subject: Re: Single Instance of a Cocoa Application.
  • From: Graham J Lee <email@hidden>
  • Date: Wed, 19 Jul 2006 15:21:17 +0100

On 19 Jul 2006, at 15:04, <email@hidden> <email@hidden> wrote:

Hi All,

I am developing an Cocoa Application using objC++.
I want to make sure that when one instance of my application is running,
an user cannot launch another instance of the same application either by
clicking the Application icon or from the terminal.



You could follow UNIX, and check for the existence of a lock file in e.g. /var/run. If it exists, quit. If it doesn't exist, create it and carry on. Delete the lock file on exit.


Difficulty one: if your user force quits the app, it won't run again. That's a documentation issue :-)
Difficulty two: fast user switching means you have to name your lock file carefully.


--
Graham J Lee
"Oxford University's UNIX Expert"
As seen in MacWorld UK
http://iamleeg.blogspot.com


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Single Instance of a Cocoa Application. (From: <email@hidden>)

  • Prev by Date: Re: Single Instance of a Cocoa Application.
  • Next by Date: Re: Single Instance of a Cocoa Application.
  • Previous by thread: Re: Single Instance of a Cocoa Application.
  • Next by thread: Re: Single Instance of a Cocoa Application.
  • Index(es):
    • Date
    • Thread