From: <jam...@te...> - 2002-09-17 21:05:37
|
> > Hi Jamie, > > > > If you call &error without explicitly calling unlock_file(), will locks > > created > > by lock_file be released? I looked at the code and it was not readily > > apearant > > that this was the case, but I could have missed something. > > > No, they won't .. however, because the lock files contain the PID of the > process that created them, as soon as it exits they will effectively be unlocked. > > However, it is probably better for the &error function to call &unlock_all_files, > so that useless .lock files aren't left hanging around. Another possibility is to create an END subroutine inside the web-lib.pl library that calls &unlock_all_files(). In this way you can ensure that if the script exits this will be called. This won't catch signals as I recall, but you can also settup various signal handlers to call END() if you wanted to go the extra mile to insure lock files go away when they are supposed to. This is also a good strategy for dealing with pid files and things like that. Cheers...james |