thread
Top  Previous  Next

val = thread ( string Command [, integer File = 0] )

Use this function to create and execute a new processing thread in the script.

Parameters
 
Command  
 
A string containing one or several statements of ImageWarp scripting language or the name of the script file to be executed in a separate thread.  
 
File  
 
An optional boolean integer specifying whether the Command parameter contains a series of script commands or the script file name:  
 
FALSE=0 – Command contains one or several statements to be executed in a new thread.  
TRUE=1 – Command contains a name of the script file whose statements will be executed in a new thread.  
Default value: FALSE  
 
Return value
 
The thread's ID.  
 
Example
 
This set of statements continuously captures an image and performs its processing in three parallel threads. The main thread of the script emphasizes the image, one additional thread applies the emboss filter and another one detects edges with the sobel operator followed by threshold.  
 
command="  
 sobel(0,100,0)   
 threshold (100,2,0,128)  
"  
do  
grabim(0)  
emphasize(0,1,10)  
'next two functions are executed in   
'separate threads  
a=thread("emboss(0,3,1)")  
b=thread(command)  
'wait for both threads to complete  
waitThread(a,b)  
loop