Subject: Re: Mail and locking
To: Michael Graff <explorer@flame.org>
From: Scott Reynolds <scottr@Plexus.COM>
List: current-users
Date: 11/26/1996 17:56:42
On 26 Nov 1996, Michael Graff wrote:

> der Mouse <mouse@Collatz.McRCIM.McGill.EDU> writes:
> 
> > A more subtle one is that programs C and D, each of which does both
> > sorts of locking but in opposite orders, can deadlock with one another.
> 
> That problem already exists.

Could you elaborate on that?  (I thought you said that all of our software
uses dot-locking, exclusively.)

> What I would do is this.
> 
> 	do {
> 		if flock() fails, continue;
> 		if dot lock fails, release flock, continue;
> 	} sleep(1 += a little);
> 
> or something like that.  That should give all the programs a chance...

As Mouse correctly points out above, it also introduces a potential for
deadlock should some other piece of software, be it elm, procmail,
fetchmail, an imapd, etc. try locking in the reverse order.  Or do you
propose that we "fix" all of those, too?

--scott