예제 #1
0
func (callback HookFun) Connect(xu *xgbutil.XUtil) {
	xu.HooksLck.Lock()
	defer xu.HooksLck.Unlock()

	// COW
	newHooks := make([]xgbutil.CallbackHook, len(xu.Hooks))
	copy(newHooks, xu.Hooks)
	newHooks = append(newHooks, callback)

	xu.Hooks = newHooks
}