in reply to Check if file is locked without locking it

If you just check the file if it is locked than you will get race conditions in your code. By the time your function is back another process can lock the file.
  • Comment on Race conditions! (Re: Check if file is locked without locking it)

Replies are listed 'Best First'.
Re: Race conditions! (Re: Check if file is locked without locking it)
by perlplexer (Hermit) on Apr 09, 2003 at 19:55 UTC
    I know. This is a non-issue in my particular case because I'm not going to modify the file, I just need to know whether or not it is locked _without_ attempting to lock it.

    --perlplexer
      The race condition means you can't tell if the file is currently locked. So even in theory it could only tell you that that file some time ago was locked or no. I think the people who wrote the library just thought this can be with only marginall usabillity and just did not implement it.