Am Montag, 2. Oktober 2006 16:13 schrieb Al Boldi:
> Burkhard Carstens wrote:
> > Am Donnerstag, 28. September 2006 22:41 schrieb John vd Waeter:
> > > Problem when program crashes. File is not deleted. Maybe refresh
> > > file every 5 minutes or so, put a timestamp in it. If timestamp
> > > older then 5 minutes, program appearantly crashed, new instance
> > > may start.
> > >
> > > John
> >
> > Put you PID in that file. That way, another instance can read that
> > file (if it exists) and check, if a process with that PID is still
> > active. If not, it's a likely, that the previous instance crashed
> > ..
> >
> > Sure, this -might- also give a false positive (prev. inst. crashed,
> > and another process got the very same PID in the meantime ..), but
> > that's pretty unlikely ..
>
> That's why it's always smart to check the /proc/[pid]/cmdline too.
.. while this still doesn't make it 100% failsafe, because the app could
have been started using a symbolic link?
OK, putting the PID + the contents of /proc/[pid]/cmdline into the
lockfile could make it pretty safe, I guess .. But then, /proc/[pid] is
linux only, isn't it? (of course, not on windows, but what with BSD?)
regards,
Burkhard
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives