[Scons-users] Suggestions for using MP Mutex during Action phase of build
Matthew Ryan
mjr at centauri.org
Sat Jan 30 11:30:08 EST 2021
If FooBuilder is a custom builder, you could perhaps move the mutex
into the action(s) that it executes.
I've done that with a couple custom builders.
On Fri, Jan 29, 2021 at 9:52 PM Manohar Reddy <manohar.mavilla at gmail.com> 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?
>
> Thanks
> Manohar
>
> On Sat, Jan 30, 2021 at 12:29 AM Bill Deegan <bill at baddogconsulting.com> wrote:
>>
>> Greetings,
>>
>> You should probably be using SideEffect() if you're trying to prevent mutual access to a file.
>>
>> -Bill
>>
>> On Fri, Jan 29, 2021 at 8:14 AM Manohar Reddy <manohar.mavilla at gmail.com> wrote:
>>>
>>> Dear Scons Community users,
>>>
>>> In SCons, we have support for a multi-process mutex that can be acquired by each build variant to coordinate writing to a shared file. The mutex is implemented through two methods:
>>>
>>> env.AcquireMPMutex()
>>> env.ReleaseMPMutex()
>>>
>>> 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. In the example above, the call to env.FooBuilder() is protected by the mutex, but this only queues up the action for SCons to perform later, and by the time SCons executes this action, the mutex will have already been released, so the actual action is not being protected.
>>>
>>> Can someone guide us on any alternative approach where the pre-action and post-action are performed right before and after the execution of the action?
>>>
>>> Thanks
>>> Manohar
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
More information about the Scons-users
mailing list