This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Semaphores in libc
On Mon, Jan 04, 2010 at 02:06:48PM +0000, Luciano Rocha wrote:
> On Mon, Jan 04, 2010 at 02:05:01PM +0100, Petar Bogdanovic wrote:
> > >
> > > Ok. If link($unique, $lockfile) returns success, then your process got
> > > the lock. If it returns failure, but stat($unique) returns the number of
> > > hardlinks > 1, then the link actually succeeded, but the client NFS code
> > > may have for some reason got confused.
> >
> > Or another thread got the lock in the meantime.
>
> Hm, no. If stat($unique) returns an hard-link count greater than 1, then
> the lockfile is the one created by the link().
If your shell example was no attempt at some kind of pseudocode then I
don't understand it.
If it indeed was a simplified version of a multi-threaded process, then
your assumption seems wrong.
Petar Bogdanovic