On Thu, Feb 25, 2010 at 2:16 PM, Thomas Bächler <thomas@archlinux.org> wrote:
Am 25.02.2010 19:44, schrieb Eric Bélanger:
Yeah, I'll look into using flock in our repo_lock function instead of doing this while loop. BTW, should the timeout time be an argument of repo_lock, i.e. each script could set its own value ? Or should we use a common value (60 seconds ?) defined in config?
I like the option. The scripts we call manually could have an infinite timeout (we can abort them manually), while the cronjobs could use very long (5 minutes) static timeouts.
After reading the flock man page, Thomas and I realized that we can't use flock in our current repo lock/unlock functions. We would need to get rid of the locking functions and explicitely use flock wherever it would be needed or do some significant code refactoring. Maybe someone with experience in using flock could shed some light on this. So we probably want to use flock eventually, but it'll be for the long term. Meanwhile, I just sent a new patch for the current repo locking functions. It makes the locking atomic and adds an optional timeout option.