Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Latest commit

 

History

History
33 lines (27 loc) · 921 Bytes

threads.add.md

File metadata and controls

33 lines (27 loc) · 921 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".