|
Boost-Build : |
From: Anichini, Steve (Sanichini_at_[hidden])
Date: 2002-11-22 13:11:34
> >>>Here I don't think that will work. If you put it at the
> end of the stack
> >>>won't that make it break the build dependency order?
> >>
> >>Why, no. You can't build things before it's dependencies
> are built, but you
> >>can delay building.
> >
> >
> > The reason I thought that it would break things is that
> AFAIK it's one stack
> > and it's populated in recursive order... and the stack
> doesn't do any
> > dependency checking, so moving things in it would be
> problematic. But I'm
> > probably wrong :-]
>
> Actually, the implementation of semaphores treats them much
> in the same way as
> dependencies. If there are unbuilt dependencies or already
> locked semaphores,
> the state is just popped. Later, when dependencies are built
> or semaphores are
> unlocked, the same target is placed to the stack again, and
> is really built.
>
> Seems like I've got this working and will commit later. It
> really does not try
> to run four linkers now!
>
Its been a while since I looked at the Jam code, but I can't poke any big
holes in this approach. If you look closely you'll see that the make1 code
is already popping things off and putting them back on later - for example,
if a target's dependencies are not yet built, it gets taken off the stack
(see make1b()), and later, when those dependencies build, the parent gets
put back on the stack (see make1c() the else case).
>From what I can gather, it sounds like you are getting to the make1c() state
on the target, see the semaphore count is 0 and thus can't execute, popping
it off the stack. Then I gather the target gets put on some sort of
semaphore "wait list", such that once the semaphore is incremented, it grabs
the semaphore and is put back on the stack, or something along those lines.
Just a question out of curiosity - can the semaphore node have a count
greater than 1? For instance, say I wanted a semaphore node that allowed
only 2 simultaneous commands. Can't really think of a case where that would
be necessary, though, so maybe its academic.
-steve
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk