mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-11 20:21:03 +00:00
Update task.js
This commit is contained in:
parent
7656327a76
commit
4c0b5f8946
28
lib/task.js
28
lib/task.js
|
@ -55,7 +55,7 @@ var TaskQueue = function() {
|
|||
};
|
||||
this.next = function() {
|
||||
var result = null;
|
||||
|
||||
|
||||
try {
|
||||
var task = this.get();
|
||||
|
||||
|
@ -88,8 +88,9 @@ var TaskQueue = function() {
|
|||
this.run = function() {
|
||||
this._keepalive = true;
|
||||
while(this._keepalive) {
|
||||
var now = new Date().getTime();
|
||||
this.next();
|
||||
sleep(100);
|
||||
sleep(1);
|
||||
}
|
||||
};
|
||||
this.stop = function() {
|
||||
|
@ -133,4 +134,25 @@ exports.run = function(q) {
|
|||
|
||||
exports.stop = function(q) {
|
||||
q.stop();
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
exports.setTimeout = function() {
|
||||
var f = null;
|
||||
var delay = 0;
|
||||
var params = [];
|
||||
|
||||
if (arguments.length > 2) {
|
||||
f = arguments[0];
|
||||
delay = arguments[1];
|
||||
params = arguments.slice(2);
|
||||
} else if (arguments.length == 2) {
|
||||
f = arguments[0];
|
||||
delay = arguments[1];
|
||||
}
|
||||
|
||||
if (f != null) {
|
||||
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user