Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 913 Bytes

threads.add.md

File metadata and controls

34 lines (27 loc) · 913 Bytes

Threads.add

The add function is established to add a thread into the threads object.

Sample

var threads = new Threads(4);
threads.add({"index":0 ,"successed":false ,run : operate});	
// operate is a function can set return value in thread object attrubites.
threads.add({"index":1 ,"successed":false ,run : operate});	
threads.add({"index":2 ,"successed":false ,run : operate});	
threads.add({"index":3 ,"successed":false ,run : operate});	

function operate(){
	if(this.index > 2){
		this.successed = false;
	}else{
		this.successed = true;
	}
}

API

CallingReturning
Threads . Add ( thread )Threads
ParametersTypeDescription
threadobjectThe thread to be added and it must have a function named "run".