 
         @worker = worker or @processTask
 
+        if @concurrency <= 0
+            throw new Error "Invalid initialization parameters"
+
         @queue =
             head: null
             tail: null

        @slots = []

        for i in [0 .. @concurrency - 1]
            @indices[i] = -1
            @slots.push i

    @getter "waiting", -> @queue.length

        @queue.length--
        return item

    scheduleEventLoop: ->
        if not @eventLoopScheduled
            @eventLoopScheduled = true
            process.nextTick @eventLoop
