in reply to flock() ..I really need a hand .. please :)
flocking it won't do much. Of course, this implies that $SEMAPHORE is a well known name (/tmp/myapp.lck), not /tmp/mlock$$.lck - unless other versions can predict the name and check if it exists, (I'm guessing $file is the useful name and the file that gets 'wiped' now and then) your lock/semaphore isn't going to help. It seems your code would allow 2 instances to mess w/ $file if they each had different $tempfile instances. It should be that they have one $SEMAPHORE to work w/, check the existence of, etc.while ( -s $SEMAPHORE ) { print STDERR "lock found waiting\n" if $debug > 10; sleep 5; }
Sorry, I don't recall your other posts, but you might also do your self some good by having the 'rename' preceeded by a debug "about to rename $tempfile to $file (I'm $this instance)" so you can see who is doing the wiping in hopes of pinpointing where your lock/semaphore goes a stray. As I read it, though your flocking isn't really giving you exclusive access for multiple instances of that code, or for anybody else, unless they're using the same $tempfile.
a
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: flock() ..I really need a hand .. please :)
by Anonymous Monk on Mar 20, 2001 at 13:47 UTC |