             _ = tasks.removeAtIndex(0) //better way?
         }
     }
-    
+
     //
     // remove all remaining tasks
     //
     public func removeAll() {
         tasks.removeAll(keepCapacity: false)
     }
-    
+
     //
     // count of the tasks left to execute
     //
     public var count: Int {
         return tasks.count
     }
-    
+
     //
     // re-run the current task
     //
     public func retry(delay: Double = 0) {
         assert(maximumNumberOfActiveTasks==1, "You can call retry() only on serial queues")
-        
+
         tasks.insert(currentTask!, atIndex: 0)
         currentTask = nil
-        
+
         self._delay(seconds: delay) {
             self.numberOfActiveTasks--
             self._runNextTask(self.lastResult)

    //
    // Provide description when printed
    //
    var description: String {
        let state = running ? "runing " : (paused ? "paused ": "stopped")
            let type = maximumNumberOfActiveTasks==1 ? "serial": "parallel"
            
            return "[TaskQueue] type=\(type) state=\(state) \(tasks.count) tasks"
    }

    deinit {
        //print("queue deinit")
    }
    
    private func _delay(seconds seconds:Double, completion:()->()) {
        let popTime = dispatch_time(DISPATCH_TIME_NOW, Int64( Double(NSEC_PER_SEC) * seconds ))
        
        dispatch_after(popTime, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0)) {
            completion()
        }
    }
    
}

//

        }
    }]
}
