Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I think that as long as your "common_resource" code never actually tries to write any important data into "lock.txt" while it has the lock on that file, you'll be fine.
There was a really good series of articles by Sean Burke in The Perl Journal a few years back about file locking, and as soon as I read it, I put some of his code into a module for creating a "semaphore file" -- an empty file whose sole purpose is to establish and hold a lock while the important "one-at-a-time" business goes on elsewhere. I've been using it for years without a hitch, on multiple OS's. I even posted it here, in response to another SoPW thread. I just checked the url for the Burke article it was taken from, and that's still working also. In reply to Re: Ways to sequence calls from multiple processes
by graff
|
|