Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 406 Bytes

README.md

File metadata and controls

26 lines (20 loc) · 406 Bytes

Usage

worker.New() starts n * Workers goroutines running func on incoming parameters sent on the returned channel.

Example

package main 

import (
	"github.com/donutloop/toolkit/worker"
	"log"
)

func main() {
	workerHandler := func(parameter interface{}) {
		v := parameter.(string)
		log.Println(v)	
	}

	queue := worker.New(2, workerHandler, 10)

	queue <- "hello"
	queue <- "world"
}