WLJS LogoWLJS Notebook

CriticalSection

CriticalSection[var, expr] acquires the lock var for parallel computation, evaluates expr, then releases the lock var.

CriticalSection[{var1, var2, ...}, expr] locks all variables vari simultaneously.

Examples

Use a critical section for thread-safe operations:

CriticalSection[lock, counter = counter + 1]

Please visit the official Wolfram Language Reference for more details.

On this page