Extension: io.warp10.script.ext.concurrent.ConcurrentWarpScriptExtension

Configuration parameters

The CEVAL function allows you to execute macros in a concurrent way on a pool of threads.

All macros will be executed with the maximum parallelism level specified. Each macro is executed on its own stack. The context of the global stack is replicated to each of those stacks so each macro will have access to the existing symbols and the redefined functions. Any modification to the symbol table or redifined functions done in a concurrent macro will not be reflected in the global stack afterwards.

Each macro is invoked with its index in the list on top of the stack.

Upon termination of each macro, the content of their respective stacks is put into a list, with the top of the stack at index 0, and those lists are merged into a global list which is then pushed onto the stack. The resulting list for each macro appears at the index of the macro in the original macro list.

Beware that no synchronization is implicitely performed between the concurrent macros. If you require synchronization between macros, for example because you are modifying a list accessible by all macros via a symbol, you must use the SYNC function.

If one of the macros fail, an attempt to interrupt the other running macros will be done and the failure will be propagated to the other macros. For the time being, a call to STOP or RETURN in one of the macros will stop all of them.

Use of CEVAL is not available from within a macro currently executing in a CEVAL call.

The CEVAL function is part of the io.warp10.script.ext.concurrent.ConcurrentWarpScriptExtension, this extenstion must be specified in the warpscript.extensions configuration parameter for it to be available.

Add the following line to your Warp 10 configuration:

// Enable CEVAL and SYNC functions
warpscript.extension.concurrent = io.warp10.script.ext.concurrent.ConcurrentWarpScriptExtension
CEVAL is available since version 1.0.0.

See also



[ <% 'N' 'C' 'C' %> <% 17 01 %> ] 2 CEVAL
//CEVAL without synchronization 0 'i' STORE [] 'l' STORE [] 's' STORE <% DROP //drop the index 42 'i' STORE //each macro runs on its own stack and context, won't be accessible later. $l [ 42 ] APPEND DROP $s 42 +! DROP // %> 'macro' STORE [] 'macroLIST' STORE 1 10000 <% DROP //drop the index $macroLIST $macro +! DROP %> FOR $macroLIST 8 CEVAL DROP $i //is still zero, not 42 $l SIZE //somewhere between 9900 and 10000 $s SIZE //somewhere between 9900 and 10000
//CEVAL with synchronization [] 'l' STORE [] 's' STORE <% DROP //drop the index <% $l [ 42 ] APPEND DROP %> SYNC <% $s 42 +! DROP %> SYNC %> 'macro' STORE [] 'macroLIST' STORE 1 10000 <% DROP //drop the index $macroLIST $macro +! DROP %> FOR $macroLIST 8 CEVAL DROP $l SIZE //exactly 10000 $s SIZE //exactly 10000