示例#1
0
func init() {
	var err error
	ctx, err = C.zmq_ctx_new()
	if ctx == nil {
		panic("Init of ZeroMQ context failed: " + errget(err).Error())
	}
}
示例#2
0
func init() {
	var err error
	defaultCtx = &Context{}
	defaultCtx.ctx, err = C.zmq_ctx_new()
	defaultCtx.opened = true
	if defaultCtx.ctx == nil {
		panic("Init of ZeroMQ context failed: " + errget(err).Error())
	}
}
示例#3
0
文件: zmq4.go 项目: gallir/zmq4
// Create a new context.
func NewContext() (ctx *Context, err error) {
	ctx = &Context{}
	c, e := C.zmq_ctx_new()
	if c == nil {
		err = errget(e)
		ctx.err = err
	} else {
		ctx.ctx = c
		ctx.opened = true
		runtime.SetFinalizer(ctx, (*Context).Term)
	}
	return
}
示例#4
0
文件: zmq4.go 项目: gallir/zmq4
func init() {
	var err error
	defaultCtx = &Context{}
	defaultCtx.ctx, err = C.zmq_ctx_new()
	defaultCtx.opened = true
	if defaultCtx.ctx == nil {
		panic("Init of ZeroMQ context failed: " + errget(err).Error())
	}
	major, minor, patch = Version()
	if major != 4 {
		panic("Using zmq4 with ZeroMQ major version " + fmt.Sprint(major))
	}
	if major != int(C.zmq4_major) || minor != int(C.zmq4_minor) {
		panic(
			fmt.Sprintf(
				"zmq4 was installed with ZeroMQ version %d.%d.%d, but the application links with version %d.%d.%d",
				int(C.zmq4_major), int(C.zmq4_minor), int(C.zmq4_patch),
				major, minor, patch))
	}
}
示例#5
0
文件: zmq_3_x.go 项目: ajanicij/gozmq
func createZmqContext() unsafe.Pointer {
	return C.zmq_ctx_new()
}