@@ -0,0 +1,28 @@
+package util
+
+import "sync"
+// CheckOnce struct
+type CheckOnce struct {
+ mutex sync.Mutex
+ done bool
+}
+// IsDone func
+func (c *CheckOnce) IsDone() bool {
+ c.mutex.Lock()
+ defer c.mutex.Unlock()
+ return c.done
+// Done func
+func (c *CheckOnce) Done(f func()) {
+ if !c.done {
+ f()
+ c.done = true
+ }