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 03:48:36PM +0000, Luciano Rocha wrote:
> On Mon, Jan 04, 2010 at 04:29:50PM +0100, Petar Bogdanovic wrote:
> > 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.
>
> It's the implementation in shell-script of the text in the manual page.
I had something completely different on my mind but after re-reading the
man page a couple of times, some lights went on. That said, the example
does make sense now, thanks!
Petar Bogdanovic