hugo: github.com/gohugoio/hugo/common/para Index | Files

package para

import "github.com/gohugoio/hugo/common/para"

Package para implements parallel execution helpers.

Index

Package Files

para.go

type Runner Uses

type Runner interface {
    Run(func() error)
    Wait() error
}

Runner wraps the lifecycle methods of a new task set.

Run wil block until a worker is available or the context is cancelled, and then run the given func in a new goroutine. Wait will wait for all the running goroutines to finish.

type Workers Uses

type Workers struct {
    // contains filtered or unexported fields
}

Workers configures a task executor with the most number of tasks to be executed in parallel.

func New Uses

func New(numWorkers int) *Workers

New creates a new Workers with the given number of workers.

func (*Workers) Start Uses

func (w *Workers) Start(ctx context.Context) (Runner, context.Context)

Start starts a new Runner.

Package para imports 2 packages (graph) and is imported by 4 packages. Updated 2020-02-28. Refresh now. Tools for package owners.