Skip to main content
Version: 5.x

NEWEXECUTOR operator

The NEWEXECUTOR operator is the creation of an action that allows the execution of other actions in a new thread pool.

Syntax

NEWEXECUTOR action THREADS threadExpr [syncType]

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.

  • syncType

    Synchronisation type. Specifies when the execution of NEWEXECUTOR action completes, allowing you to choose between synchronous and asynchronous approaches. Specified by one of the keywords:

    • WAIT - after all threads have completed execution. This value is used by default.
    • NOWAIT - immediately after all threads have been started.

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;
}