Subject: | Funtion name a bit misleading |
Hi Steffen,
I find the locked() function name a bit misleading. May I suggest that
you rename it to got_lock() because it checks if _I_ got the lock, not
if the file is being locked by another process. Also, it might be useful
to have a companion function called is_locked() that checks if someone
else has got the lock on the file.
This remarks are because I currently have a workflow that is not very
well accommodated by File::SharedNFSLock: one process writes a file and
the others read the file (after it is written) in parallel. At the
moment, the 'readers' lock() because they cannot start reading until the
'writer' is finished (has used unlock()). But because everyone can read
at the same time, each reader has to unlock() as soon as they get the
lock. It would be better if one could have a non-blocking lock. I have
noticed the timeout_acquire option, but it is not clear if it is at all
related to my query.
Best,
Florent