in reply to flock LOCK_EX not locking exclusively
child 1 child 2 open(...) open(...) flock(...) unlink(...) close(...) flock(...) (succeeds!) ... ...
In general flock and unlink on the same file do not work well together. You really only want to use flock on a file which will always exist. Assuming that in this case you are simulating a pool of worker threads trying to grab a unit of work, you can fix things by checking to see if the file still exists after the flock succeeds.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: flock LOCK_EX not locking exclusively
by Anonymous Monk on Jan 03, 2008 at 09:30 UTC | |
by pc88mxer (Vicar) on Jan 03, 2008 at 15:51 UTC |