index.js
function update() {
		while (waiting.length && count < concurrency) (function() {
			var t = waiting.shift()
			
			if (inProg[t.task.id]) {
				inProg[t.task.id].push(t.cb)
				return
			} else {
				inProg[t.task.id] = [t.cb]
				count++
				processor(t.task, function() {
					var args = arguments

					if (!inProg[t.task.id]) return // probably callback called twice
	
					count--
					inProg[t.task.id].forEach(function(cb) { cb.apply(null, args) })
					delete inProg[t.task.id]
	
					setImmediate(update)
				})
			}	
		})()
	}
function update() {
		while (waiting.length && count < concurrency) (function() {
			var t = waiting.shift()
			
			if (inProg[t.task.id]) {
				inProg[t.task.id].push(t.cb)
				return
			} else {
				inProg[t.task.id] = [t.cb]
				count++
				processor(t.task, function() {
					var args = arguments

					if (!inProg[t.task.id]) return // probably callback called twice
	
					count--
					inProg[t.task.id].forEach(function(cb) { cb.apply(null, args) })
					delete inProg[t.task.id]
	
					setImmediate(update)
				})
			}	
		})()
	}
function update ( ) { while ( waiting . length && count < concurrency ) ( function ( ) { var t = waiting . shift ( ) if ( inProg [ t . task . id ] ) { inProg [ t . task . id ] . push ( t . cb ) return } else { inProg [ t . task . id ] = [ t . cb ] count ++ processor ( t . task , function ( ) { var args = arguments if ( ! inProg [ t . task . id ] ) return // probably callback called twice count -- inProg [ t . task . id ] . forEach ( function ( cb ) { cb . apply ( null , args ) } ) delete inProg [ t . task . id ] setImmediate ( update ) } ) } } ) ( ) }
var paused = false
var paused = false