Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter counts the references to a resource. When the counter is closed then the provided close func is invoked only after the count reaches 0.
func NewCounter ¶
func NewCounter(closer func()) *Counter
NewCounter returns a new Counter. The provided function is invoked when the counter is closed and the reference count is 0.
func (*Counter) Close ¶
func (r *Counter) Close()
Close closes the counter, which will cause the close function to be invoked after the count reaches 0.
Click to show internal directories.
Click to hide internal directories.