<blocksapp="Snap! 6, https://snap.berkeley.edu"version="1"><block-definitions="do in parallel %'actions' and wait"type="command"category="control"><commentw="238.66666666666666"collapsed="false">Accepts any number of scripts as inputs. Launches a separate thread for each of them, so they are done in parallel, then waits for them all to complete.

This doesn't change how the Snap! scheduler works; the threads are not truly asynchronous. And there is no increase in speed. Rather, the point of this block is to allow starting synchronized but independent scripts.</comment><header></header><code></code><translations>pt:executa _ em paralelo e espera
</translations><inputs><inputtype="%mult%cs"></input></inputs><script><blocks="doDeclareVariables"><list><l>threads</l></list></block><blocks="doSetVar"><l>threads</l><blocks="reportMap"><blocks="reifyReporter"><autolambda><blocks="evaluate"><blocks="reifyScript"><script><blocks="doDeclareVariables"><list><l>is running?</l></list></block><blocks="doSetVar"><l>is running?</l><blocks="reportBoolean"><l><bool>true</bool></l></block></block><blocks="fork"><blocks="reifyScript"><script><blocks="doRun"><blockvar="each script"/><list></list></block><blocks="doSetVar"><l>is running?</l><blocks="reportBoolean"><l><bool>false</bool></l></block></block></script><list></list></block><list></list></block><blocks="doReport"><blocks="reifyScript"><script><blocks="doReport"><blockvar="is running?"/></block></script><list></list></block></block></script><list></list></block><list></list></block></autolambda><list><l>each script</l></list></block><blockvar="actions"/></block></block><blocks="doWaitUntil"><blocks="reportListIsEmpty"><blocks="reportKeep"><blocks="reifyPredicate"><autolambda><blocks="evaluate"><blockvar="test"/><list></list></block></autolambda><list><l>test</l></list></block><blockvar="threads"/></block></block></block></script></block-definition><block-definitions="do in parallel %'actions'"type="command"category="control"><commentw="238.66666666666666"collapsed="false">Accepts any number of scripts as inputs. Launches a separate thread for each of them, so they are done in parallel, then continues with the current script while they all run.

This doesn't change how the Snap! scheduler works; the threads are not truly asynchronous. And there is no increase in speed. Rather, the point of this block is to allow starting synchronized but independent scripts.</comment><header></header><code></code><translations>pt:executa _ em paralelo
</translations><inputs><inputtype="%mult%cs"></input></inputs><script><blocks="doIf"><blocks="reportGreaterThan"><blocks="reportListLength"><blockvar="actions"/></block><l>0</l></block><script><blocks="fork"><blocks="reportListItem"><l>1</l><blockvar="actions"/></block><list></list></block><custom-blocks="do in parallel %mult%cs"><blocks="reportCDR"><blockvar="actions"/></block></custom-block></script></block></script></block-definition></blocks>