Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RefCount ¶
type RefCount struct { Action func(err error) OnError func(old, new error) error // contains filtered or unexported fields }
RefCount is an atomic reference counter. It can be used to track a shared resource it's lifetime and execute an action once it is clear the resource is not needed anymore.
The zero value of RefCount is already in a valid state, which can be Released already.
func (*RefCount) Fail ¶
Fail adds an error to the reference counter. OnError will be called if configured, so to compute the actual error. If OnError is not configured, the first error reported will be stored by the reference counter only.
Fail releases the reference counter.
Directories ¶
Path | Synopsis |
---|---|
Package atomic provides common primitive types with atomic accessors.
|
Package atomic provides common primitive types with atomic accessors. |
Package ctxtool provides extra functionality and tools for use with context.Context.
|
Package ctxtool provides extra functionality and tools for use with context.Context. |
Click to show internal directories.
Click to hide internal directories.