Ok, I don't want to be too much of a pain - I can see the way things have
gone and my attitude is "oh well" but I thought I'd put the case anyhow:

1)  sem_timedwait() in posix lets you timeout so in a big build when
something crashes or just sits around, there is at least the option of
printing an error message or giving up on locking from that point on which
is a bit of a godsend if it happens overnight and there's no-one to restart
the build.   With stdio and file locks I don't know if this is a problem
anyhow for crashes (are locks automatically released?) but the behaviour
between windows and linux might be different.

2) Semaphores have the semantics you want a) the ability to lock b)
system-wide c) named so that processes can access them. So it seems simpler
to me to use that semantic as the model and implement it in whatever is the
most faithful way for each platform.

3) As for POSIX semaphores, I found that one could do a lot by just having
init and delete functions that created and destroyed them at the start and
end of make execution. Only the parent make does this of course. You can
make them live in /tmp which is volatile anyhow and you pre-delete ones
that by incredible luck might exist before make started and have the same
name as the one you want to use.

4) In a way this makes the file-lock and semaphore mechanisms "look" rather
the same - files in /tmp. This seems easier to understand.

It's no big deal, though.

Regards,

Tim



On 25 April 2013 19:12, Paul Smith <psm...@gnu.org> wrote:

> On Thu, 2013-04-25 at 07:14 +0100, Tim Murphy wrote:
> > To be honest, I have done all this before with named semaphores
> > including the "file that gets left over" problem and it's all solvable
> > quite nicely.  You pass the build id in the environment which is,
> > after all, what it's for.
>
> Sure.  Given enough effort all programming problems are solvable.  The
> question is what is the effort, and what is the benefit?
>
> At the moment to me it looks like the effort is not insignificant and I
> don't see the benefit.  However, that may well just mean I haven't
> thought of something.  Can you give a quick outline of how the cleanup /
> error handling might work, and what advantages using named semaphores
> has?
>
> Cheers!
>
>
>


-- 
You could help some brave and decent people to have access to uncensored
news by making a donation at:

http://www.thezimbabwean.co.uk/friends/
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to