Package Usage: go: gopkg.in/tomb.v2
The tomb package handles clean goroutine tracking and termination.
The zero value of a Tomb is ready to handle the creation of a tracked
goroutine via its Go method, and then any tracked goroutine may call
the Go method again to create additional tracked goroutines at
any point.
If any of the tracked goroutines returns a non-nil error, or the
Kill or Killf method is called by any goroutine in the system (tracked
or not), the tomb Err is set, Alive is set to false, and the Dying
channel is closed to flag that all tracked goroutines are supposed
to willingly terminate as soon as possible.
Once all tracked goroutines terminate, the Dead channel is closed,
and Wait unblocks and returns the first non-nil error presented
to the tomb via a result or an explicit Kill or Killf method call,
or nil if there were no errors.
It is okay to create further goroutines via the Go method while
the tomb is in a dying state. The final dead state is only reached
once all tracked goroutines terminate, at which point calling
the Go method again will cause a runtime panic.
Tracked functions and methods that are still running while the tomb
is in dying state may choose to return ErrDying as their error value.
This preserves the well established non-nil error convention, but is
understood by the tomb as a clean termination. The Err and Wait
methods will still return nil if all observed errors were either
nil or ErrDying.
For background and a detailed example, see the following blog post:
2 versions
Latest release: over 8 years ago
811 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/gopkg.in/tomb.v2
Dependent Repos 2
1024pix/steampipe-plugin-learningcontent
Steampipe plugin to query LCMS contentSize: 101 KB - Last synced: 5 days ago - Pushed: over 1 year ago

1024pix/steampipe-plugin-metabase
Use SQL to query databases, tables, permissions and more from MetabaseSize: 1.22 MB - Last synced: 5 days ago - Pushed: 5 days ago
