Re: Finding out whether app crashed

objectwerks inc <chad+macosx-AU1NHruoRJaEK/[email protected]> Thu, 7 Jul 2011 11:54:13 -0600
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Jul 7, 2011, at 11:29 AM, Christiaan Hofman wrote:

>=20
> On Jul 7, 2011, at 17:48, Markus Hitter wrote:
>=20
>>=20
>> Am 06.07.2011 um 23:40 schrieb Christiaan Hofman:
>>=20
>>> Is there a way to figure out at launch time whether my app crashed =
at the last run?
>>=20
>> Create a file somewhere at application start and remove it at normal =
application close. In case of an unexpected abort, the file is still =
there at the next app launch.
>>=20
>> The classical Unix place for such stamp files is /var/run.
>>=20
>>=20
>> Markus
>=20
>=20
> Is this really the preferred way of doing this?
>=20
> I can imagine that somehow another instance of the app is launched, =
and this will notice that the last launched instance was running and was =
not (yet) terminated. That gives the wrong result.


Whether this is the best way to do it on OS X with a regular GUI type =
app, is not something I will address, as I don't know.  However, things =
like pid get stored in these little files so the new app can check if =
the pid is still running or not so it knows if the app is a real other =
process app or a crashed app.