Skip to content

ysh0566/resourcepool

Repository files navigation

type TestResource struct {
	id int64
	closed bool
}


func(tr TestResource) Close() {
	if !tr.closed {
		count.Add(-1)
		tr.closed = true
	}
}

func ResourceFactory() (Resource, error) {
	count.Add(1)
	return TestResource{lastId.Add(1), false}, nil
}

func main(){
    pool := NewResourcePool(ResourceFactory, 10, 10, time.Second)
}

About

resourcepool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages