ThreadNew
Creates a new thread of execution based on the passed closure/lambda.
Method Signature
ThreadNew(runnable=[function], attributes=[struct], name=[string], priority=[string], virtual=[boolean])Arguments
Argument
Type
Required
Description
Default
runnable
function
true
The closure/lambda to execute in the new thread.
attributes
struct
false
A struct of data to bind into the thread's scope.
{}
name
string
false
priority
string
false
The priority of the thread. Possible values are "high", "low", and "normal". Default is "normal".
normal
Examples
Create a new thread
t = threadNew( () => {
sleep( 100 );
println( "thread running" );
} );
threadJoin( t );
writeOutput( "done" );
Result: done
Named thread
Result: myThread
Related
Last updated
Was this helpful?
