grpool: github.com/ivpusic/grpool Index | Files | Directories

package grpool

import "github.com/ivpusic/grpool"

Index

Package Files

grpool.go

type Job Uses

type Job func()

Represents user request, function which should be executed in some worker.

type Pool Uses

type Pool struct {
    JobQueue chan Job
    // contains filtered or unexported fields
}

func NewPool Uses

func NewPool(numWorkers int, jobQueueLen int) *Pool

Will make pool of gorouting workers. numWorkers - how many workers will be created for this pool queueLen - how many jobs can we accept until we block

Returned object contains JobQueue reference, which you can use to send job to pool.

func (*Pool) JobDone Uses

func (p *Pool) JobDone()

In case you are using WaitAll fn, you should call this method every time your job is done.

If you are not using WaitAll then we assume you have your own way of synchronizing.

func (*Pool) Release Uses

func (p *Pool) Release()

Will release resources used by pool

func (*Pool) WaitAll Uses

func (p *Pool) WaitAll()

Will wait for all jobs to finish.

func (*Pool) WaitCount Uses

func (p *Pool) WaitCount(count int)

How many jobs we should wait when calling WaitAll. It is using WaitGroup Add/Done/Wait

Directories

PathSynopsis
examples

Package grpool imports 1 packages (graph) and is imported by 10 packages. Updated 2019-05-06. Refresh now. Tools for package owners.