Ejemplo n.º 1
0
func fromCChannel(ch *C.dpx_channel) *Channel {
	if ch == nil {
		return nil
	}

	channel := &Channel{ch: ch}
	runtime.SetFinalizer(channel, func(x *Channel) {
		if int(C.dpx_channel_closed(x.ch)) == 0 {
			// memleak. drop the reference and leave it be.
			return
		}
		C.dpx_channel_free(x.ch)
	})
	return channel
}
Ejemplo n.º 2
0
func (c *Channel) Closed() bool {
	return int(C.dpx_channel_closed(c.ch)) != 0
}