On Fri, 19 Nov 2010 23:02:11 +0100, Cox, Stuart TRAN:EX <stuart....@gov.bc.ca> wrote:

I think the easiest way to get cross-platform lockfile behaviour, is to
a) create the lockfile at the start of your program (e.g., a rewrite
followed by a close)
b) whenever you want to lock it, use

systutils.fileopen(lockfilename,fmOpenWrite or fmShareExclusive);

If that function returns -1, acquiring the lock failed.

This is bound to fail if someone deleted the lock file in between.

Something similar happened here with some commercial tool we use. It
then refused to open, because "another user already locked it".

Just thought, I mention it. No need to duplicate other's people mistakes. ;)


Vinzent.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to