[Scons-users] Suggestions for using MP Mutex during Action phase of build

Luke Robison lukerobison at gmail.com
Sat Jan 30 10:50:16 EST 2021


I'm not sure what problem exactly you are trying to solve, but one thing
I've done is out-of-place builds in different folders for different build
configurations.  We use this to switch between debug and release versions
without rebuilding everything.

I haven't tried to execute those builds simultaneously, but perhaps that
would help your problem?

On Sat, Jan 30, 2021, 9:26 AM Mats Wichmann <mats at wichmann.us> wrote:

> On 1/29/21 10:52 PM, Manohar Reddy wrote:
> > Hi Bill,
> >
> > Thanks for your prompt response.
> >
> > We run multiple builds in parallel in different processes. Would calling
> > SideEffect() from one build in one process prevent mutual access to a
> > file from other builds running in separate processes?
>
> No.
>
>
> >         Example usage:
> >
> >         env.AcquireMPMutex("foo_file")
> >         if not os.exists("foo.file"):
> >              env.FooBuilder("foo.file", "foo.source")
> >         env.ReleaseMPMutex("foo_file")
> >
> >         But, this is currently not working for the action phase of the
> >         build.
>
> As I guess you've seen, this isn't really of any use, as these
> instructions will take place during the SConscript reading phase, when
> no file building takes place. SCons uses its time in this phase to build
> up the complete dependency graph, before starting the build phase, where
> a component called the Taskmaster walks this graph and enqueues and
> fires off the individual build jobs (consisting of one or more actions)
> as they become eligible to build. You're going to have to reach inside
> SCons/Executor.py to find where the actions are actually executed - and
> this is very internal not-public-API type code.  This probably isn't
> ideal - there's already Python's own (per-process) Global Interpreter
> Lock and you're going to add another level of locking, but only you know
> the scope of the problem you need to solve....
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20210130/975216d0/attachment.html>


More information about the Scons-users mailing list