Skip to content

luliangce/spool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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()
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published