MCPcopy
hub / github.com/purpleidea/mgmt / EasyOnce

Struct EasyOnce

util/sync.go:62–66  ·  view source on GitHub ↗

EasyOnce is a wrapper for the sync.Once functionality which lets you define and register the associated `run once` function at declaration time. It may be copied at any time.

Source from the content-addressed store, hash-verified

60// and register the associated `run once` function at declaration time. It may
61// be copied at any time.
62type EasyOnce struct {
63 Func func()
64
65 once *sync.Once
66}
67
68// Done runs the function which was defined in `Func` a maximum of once. Please
69// note that this is not currently thread-safe. Wrap calls to this with a mutex.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected