Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 405 Bytes

readme.md

File metadata and controls

29 lines (21 loc) · 405 Bytes

Spool

a extremely simple task pool with golang.org/x/sync/semaphore and sync/WaitGroup

Guide

//example/main.go
package main

import (
	"context"
	"time"

	"github.com/luliangce/spool"
)

func main() {
	pool := spool.NewPool(10) //define a pool size

	for i := 0; i < 100; i++ {
		pool.Go(context.Background(), func() {
			time.Sleep(time.Millisecond * 100)
		})
	}
	pool.Wait()
}