perlplexer,
Thank you for your reply.
Could you explain what you mean by "when a signal is received while flock() is blocked"?
Richard | [reply] |
Suppose you have two processes that work with the same lock file and each take 5 minutes to complete. One process starts up, locks the file, and then proceeds to do whatever it's designed to do. A second instance of this process is then started by some other user a minute later. This instance will call flock(), which will block and wait until the first instance releases the lock. If during this time this second instance is interrupted by a signal; e.g, ALRM, INT, etc., flock() will return and $! will be set to "Interrupted system call" (IIRC). If your program does not check the return value and continues to run, it'll clobber the file.
--perlplexer
| [reply] |
| [reply] |