Subject: Re: [HELP] Folder locking mechanism

From: Mark Crispin <[email-masked]>
Date: Mon, 18 Jul 1994 22:57:30 -0700 (PDT)

> > > Because there are many different schemes of mail file locking used on UNIX,
> > > Pine implements all of them.
> > _All_?  How did you find out the scheme _I_ use? = )

I don't.  I apply all of them.

> > Pardon the unaffected simplicy, but what happens if multiple processes
> > decide to "grab it for ourselves." 

This is unlikely to happen due to the nature of this particular lock.  It 
is also unavoidable due to the nature of this particular lock.  Blame 
the people who designed locking of UNIX mail files 15+ years ago; it's 
all their fault.

Fortunately, as noted above, it is very unlikely to happen.  This 
particular lock is used only for brief periods of time.  If something has 
it seized for 5 minutes, something is wrong.  There is some level of 
protection in that the file date is checked.

> > Please explain why you don't check whether "flock (fd,op)" above succeeds.

The blocking form of flock() is used.  It always succeeds.  If the file 
is locked, it will hang.