Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SCons, multithreading, management

I'll be short in my question. I'm setting up 'num_jobs' environment option. As you might know it makes SCons run in multithreading mode (depends on cpu count). In my custom builder I call some outer executable via subprocess which prints some output to stdout.

So the question is: how to synchronize that output to stdout? I need to synchronize output because I have 4 cpus and during building I have messed up information.

Thanks.

like image 645
kvv Avatar asked Mar 15 '26 13:03

kvv


1 Answers

You can use SideEffect.

def MyFunc(env, param):
    run_ret = env.Command(... external command using param ...)

    # ensure that no unit tests are run in parallel
    env.SideEffect('#/GLOABL_LOCK', run_ret)

Then AddMethod MyFunc to your environment. The SideEffect ensures that the different calls to the Command won't be simultaneous.

like image 75
BugoK Avatar answered Mar 17 '26 03:03

BugoK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!