in reply to Re: Re: correct usage of flock?
in thread correct usage of flock?
The first process will do it's thing and then delete the file. The second process will grab the lock on the still opened file, and then process as if it had the lock -- it won't know the file has been unlinked. If you can live with this, that's fine. If you want "exactly once" semantics, it's not.
FWIW, in general it's not a good idea to try to use an object's lock to synchronize the destruction of that object -- it is easy to overlook a race condition. You might get away with this in certain cases, but in general you'll rest easier if you use a different way. See one of the other methods described above (e.g. Ovid's 'sentinel', file renaming, etc.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: correct usage of flock?
by sierrathedog04 (Hermit) on Jun 06, 2001 at 19:31 UTC | |
by cLive ;-) (Prior) on Jun 06, 2001 at 20:15 UTC | |
by sierrathedog04 (Hermit) on Jun 06, 2001 at 23:29 UTC | |
by bluto (Curate) on Jun 08, 2001 at 18:56 UTC |