Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 453 Bytes

README.md

File metadata and controls

24 lines (20 loc) · 453 Bytes

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