public function call($procedure, $varArgs = null /*..., $argN*/) {
        if (!is_string($procedure)) {
            throw new \InvalidArgumentException(
                sprintf('%s requires a string at Argument 1', __METHOD__)
            );
        }

        if (!$this->isStarted) {
            $this->start();
        }

        if ($this->maxTaskQueueSize < 0 || $this->maxTaskQueueSize > $this->outstandingTaskCount) {
            $task = $this->taskReflection->newInstanceArgs(func_get_args());
            return $this->acceptNewTask($task);
        } else {
            return new Failure(new TooBusyException(
                sprintf("Cannot execute '%s' task; too busy", $procedure)
            ));
        }
    }
public function call($procedure, $varArgs = null /*..., $argN*/) {
        if (!is_string($procedure)) {
            throw new \InvalidArgumentException(
                sprintf('%s requires a string at Argument 1', __METHOD__)
            );
        }

        if (!$this->isStarted) {
            $this->start();
        }

        if ($this->maxTaskQueueSize < 0 || $this->maxTaskQueueSize > $this->outstandingTaskCount) {
            $task = $this->taskReflection->newInstanceArgs(func_get_args());
            return $this->acceptNewTask($task);
        } else {
            return new Failure(new TooBusyException(
                sprintf("Cannot execute '%s' task; too busy", $procedure)
            ));
        }
    }
public function call ( $ procedure , $ varArgs = null /*..., $argN*/ ) { if ( ! is_string ( $ procedure ) ) { throw new \ InvalidArgumentException ( sprintf ( '%s requires a string at Argument 1' , __METHOD__ ) ) ; } if ( ! $ this -> isStarted ) { $ this -> start ( ) ; } if ( $ this -> maxTaskQueueSize < 0 || $ this -> maxTaskQueueSize > $ this -> outstandingTaskCount ) { $ task = $ this -> taskReflection -> newInstanceArgs ( func_get_args ( ) ) ; return $ this -> acceptNewTask ( $ task ) ; } else { return new Failure ( new TooBusyException ( sprintf ( "Cannot execute '%s' task; too busy" , $ procedure ) ) ) ; } }
Dispatch a procedure call to the thread pool

This method will auto-start the thread pool if workers have not been spawned.

@param string $procedure The name of the function to invoke
@param mixed $varArgs A variable-length argument list to pass the procedure
@throws \InvalidArgumentException if the final parameter is not a valid callback
@return \Amp\Promise
Dispatch a procedure call to the thread pool