MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / Do

Method Do

utils/once.go:31–42  ·  view source on GitHub ↗

Do handles once logic.

(f func())

Source from the content-addressed store, hash-verified

29
30// Do handles once logic.
31func (o *Once) Do(f func()) {
32 if atomic.LoadUint32(&o.done) == 1 {
33 return
34 }
35 // Slow-path.
36 o.m.Lock()
37 defer o.m.Unlock()
38 if o.done == 0 {
39 defer atomic.StoreUint32(&o.done, 1)
40 f()
41 }
42}
43
44// Reset make the once object to be initialized once again.
45func (o *Once) Reset() {

Callers 9

TestOnceFunction · 0.95
ackWorkerMethod · 0.80
initLocalKeyStoreFunction · 0.80
NewChainWithContextFunction · 0.80
initFunction · 0.80
doneMethod · 0.80
initResolverFunction · 0.80

Calls

no outgoing calls

Tested by 3

TestOnceFunction · 0.76
initFunction · 0.64