initial import
This commit is contained in:
10
core/syncx/once.go
Normal file
10
core/syncx/once.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package syncx
|
||||
|
||||
import "sync"
|
||||
|
||||
func Once(fn func()) func() {
|
||||
once := new(sync.Once)
|
||||
return func() {
|
||||
once.Do(fn)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user