Subject: Re: Mail and locking
To: der Mouse <mouse@Holo.Rodents.Montreal.QC.CA>
From: Michael Graff <explorer@flame.org>
List: current-users
Date: 11/26/1996 12:48:12
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.  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...

--Michael