示例#1
0
// Detach unregisters the given event id.
func (this *EventManager) Detach(id int) (err error) {
	if this.ptr == nil {
		return &VLCError{"EventManager is nil"}
	}

	var ed *eventData
	var ok bool

	this.m.Lock()
	if ed, ok = this.events[id]; !ok {
		this.m.Unlock()
		return &VLCError{"No event with that id"}
	}

	delete(this.events, id)
	this.m.Unlock()

	C.goDetach(this.ptr, ed.t, unsafe.Pointer(ed))
	return
}
示例#2
0
// Detach unregisters the given event id.
func (this *EventManager) Detach(id int) (err error) {
	if this.ptr == nil {
		return os.EINVAL
	}

	var ed *eventData
	var ok bool

	this.m.Lock()
	if ed, ok = this.events[id]; !ok {
		this.m.Unlock()
		return os.EINVAL
	}

	delete(this.events, id)
	this.m.Unlock()

	C.goDetach(this.ptr, ed.t, unsafe.Pointer(ed))
	return
}