mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-19 17:51:41 +00:00
some cleanup and minor tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ba46bc3707
commit
dc178652a8
@ -82,11 +82,18 @@ function getWorkerQueue(name, pool_size, no_auto_start, no_progress){
|
|||||||
|
|
||||||
// Kill all worker queues...
|
// Kill all worker queues...
|
||||||
//
|
//
|
||||||
// Returns a deffered object that will get resolved when all workers are
|
// Returns a deffered that will get resolved when all workers are
|
||||||
// actually stopped...
|
// actually stopped...
|
||||||
|
//
|
||||||
|
// NOTE: this will not stop the already started tasks, just drop all
|
||||||
|
// worker queues, thus it may take some time for workers to
|
||||||
|
// actually stop...
|
||||||
|
// NOTE: if no workers are loaded or all are already done, the deferred
|
||||||
|
// returned will be resolved...
|
||||||
function killAllWorkers(){
|
function killAllWorkers(){
|
||||||
var res = $.Deferred()
|
var res = $.Deferred()
|
||||||
var w = []
|
var w = []
|
||||||
|
|
||||||
Object.keys(WORKERS).forEach(function(k){
|
Object.keys(WORKERS).forEach(function(k){
|
||||||
if(WORKERS[k].isRunning()){
|
if(WORKERS[k].isRunning()){
|
||||||
var wd = $.Deferred()
|
var wd = $.Deferred()
|
||||||
@ -102,6 +109,7 @@ function killAllWorkers(){
|
|||||||
})
|
})
|
||||||
WORKERS = {}
|
WORKERS = {}
|
||||||
|
|
||||||
|
// resolve the deferred as soon as ALL the workers are done...
|
||||||
$.when.apply(null, w)
|
$.when.apply(null, w)
|
||||||
.done(function(){
|
.done(function(){
|
||||||
console.log('Worker: All workers stopped.')
|
console.log('Worker: All workers stopped.')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user