NEWEXECUTOR operator
The NEWEXECUTOR
operator creates an action that enables executing other actions in a new thread pool.
Syntax
NEWEXECUTOR action THREADS threadExpr
Description
The NEWEXECUTOR
operator creates an action that creates a new thread pool and executes the defined action in such a way that any action created with the NEWTHREAD
operator will be executed in one of the threads of the created pool.
Parameters
-
action
A context-dependent action operator that defines an action to be executed.
-
threadExpr
An expression which value determines the number of threads in the pool. Must return the value of the
INTEGER
class.
Examples
testExecutor {
NEWEXECUTOR {
FOR id(Sku s) DO {
NEWTHREAD {
NEWSESSION {
name(s) <- STRING[20](id(s)); // writing the code into the name in 10 threads
APPLY;
}
}
}
} THREADS 10;
}