public function execute(\Stackable $task) {
        if (!$this->isStarted) {
            $this->start();
        }

        if ($this->maxTaskQueueSize < 0 || $this->maxTaskQueueSize > $this->outstandingTaskCount) {
            return $this->acceptNewTask($task);
        } else {
            return new Failure(new TooBusyException(
                sprintf('Cannot execute task of type %s; too busy', get_class($task))
            ));
        }
    }
public function execute(\Stackable $task) {
        if (!$this->isStarted) {
            $this->start();
        }

        if ($this->maxTaskQueueSize < 0 || $this->maxTaskQueueSize > $this->outstandingTaskCount) {
            return $this->acceptNewTask($task);
        } else {
            return new Failure(new TooBusyException(
                sprintf('Cannot execute task of type %s; too busy', get_class($task))
            ));
        }
    }
public function execute ( \ Stackable $ task ) { if ( ! $ this -> isStarted ) { $ this -> start ( ) ; } if ( $ this -> maxTaskQueueSize < 0 || $ this -> maxTaskQueueSize > $ this -> outstandingTaskCount ) { return $ this -> acceptNewTask ( $ task ) ; } else { return new Failure ( new TooBusyException ( sprintf ( 'Cannot execute task of type %s; too busy' , get_class ( $ task ) ) ) ) ; } }
Dispatch a pthreads Stackable to the thread pool for processing

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

@param \Stackable $task A custom pthreads stackable
@return \Amp\Promise
Dispatch a pthreads Stackable to the thread pool for processing