Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 913 Bytes

threads.run.md

File metadata and controls

38 lines (29 loc) · 913 Bytes

Threads.run

The run function is established to run all the thread of the threads object.

Sample

var threads = new Threads(4);
threads.add({"index":0 ,"successed":false ,run : operate});
threads.add({"index":1 ,"successed":false ,run : operate});
threads.add({"index":2 ,"successed":false ,run : operate});
threads.add({"index":3 ,"successed":false ,run : operate});
var errorData = threads.run().seek("successed", "eq", false);
if(errorData.length !=0){
	var errorDataArr = errorData.getArray();
	for(var i = 0 ; i < errorDataArr.length ; i++){
		errorDataArr[i].index.debug("operation has errors"); 
	}
}
	

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

API

CallingReturning
Threads . Run ( )Record contained all of thead object.