Kraken\Runtime\Container\Manager\ThreadManagerBase::flushThreads PHP Method

flushThreads() public method

public flushThreads ( $flags = Runtime::DESTROY_KEEP )
    public function flushThreads($flags = Runtime::DESTROY_KEEP)
    {
        $promises = [];
        if ($flags === Runtime::DESTROY_KEEP) {
            return Promise::doReject(new RejectionException('Threads storage could not be flushed because of force level set to DESTROY_KEEP.'));
        }
        foreach ($this->threads as $alias => $process) {
            $promises[] = $this->destroyThread($alias, $flags);
        }
        return Promise::all($promises)->then(function () {
            $this->threads = [];
            return 'Threads storage has been flushed.';
        });
    }