some cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-07-14 21:12:14 +04:00
parent 0df4f139d8
commit 813226e6f3
3 changed files with 8 additions and 13 deletions

View File

@ -1180,24 +1180,27 @@ function getPrevLocation(){
/********************************************************* Workers ***/ /********************************************************* Workers ***/
// get/create a named worker queue... // get/create a named worker queue...
//
function getWorkerQueue(name, no_auto_start){ function getWorkerQueue(name, no_auto_start){
// attach the the previous queue...
// create a new worker queue...
if(WORKERS[name] == null){ if(WORKERS[name] == null){
var queue = makeDeferredsQ() var queue = makeDeferredsQ()
WORKERS[name] = queue WORKERS[name] = queue
// start if needed...
if(!no_auto_start){ if(!no_auto_start){
queue.start() queue.start()
} }
// return existing worker queue...
} else { } else {
var queue = WORKERS[name] var queue = WORKERS[name]
} }
return queue return queue
} }
// kill all worker queues... // kill all worker queues...
//
function killAllWorkers(){ function killAllWorkers(){
for(var k in WORKERS){ for(var k in WORKERS){
console.log('Worker: Stopping:', k) console.log('Worker: Stopping:', k)

View File

@ -731,15 +731,6 @@ function updateImagesOrientationQ(gids, no_update_loaded){
.fail(function(){ queue.notify(gid, 'fail') }) .fail(function(){ queue.notify(gid, 'fail') })
}) })
// auto-stop the queue...
if(last != null){
// NOTE: this is mostly for reporting...
// XXX do we need to auto-stop this???
last.done(function(){
queue.resolve()
})
}
return queue return queue
} }

View File

@ -696,8 +696,9 @@ function makeDeferredsQ(first){
*/ */
// Report work state... // Report work state...
// XXX make this a propper state, or integrate into the deferred in // XXX make this a proper state, or integrate into the deferred in
// a more natural way... // a more natural way...
// ...need a way to bind to this state change...
queue.isWorking = function(){ queue.isWorking = function(){
if(queue.state() != 'resolved' && last.state() != 'resolved'){ if(queue.state() != 'resolved' && last.state() != 'resolved'){
return true return true