/* Terminates the current default and all old default contexts. For linger behavior, see: http://api.zeromq.org/2-2:zmq-term */ func Term() error { if defaultCtx.opened { defaultCtx.opened = false n, err := C.zmq_term(defaultCtx.ctx) if n != 0 { defaultCtx.err = errget(err) } } if defaultCtx.err != nil { return defaultCtx.err } for _, oldCtx := range old { if oldCtx.opened { oldCtx.opened = false n, err := C.zmq_term(oldCtx.ctx) if n != 0 { oldCtx.err = errget(err) } } if oldCtx.err != nil { return oldCtx.err } } return nil }
/* Terminates the context. For linger behavior, see: http://api.zeromq.org/2-2:zmq-term */ func (ctx *Context) Term() error { if ctx.opened { ctx.opened = false n, err := C.zmq_term(ctx.ctx) if n != 0 { ctx.err = errget(err) } } return ctx.err }
// Closes the Context. Close will block until all related Sockets are closed, and all pending messages are either // physically transferred to the network or the socket's linger period expires. func (c *Context) Close() { for { r := C.zmq_term(c.ctx) if r == -1 { if C.my_errno() == C.EINTR { continue } panic(zmqerr()) } break } }
// Calls zmq_term on underlying context pointer // // Only call once func (p lzmqContext) Terminate() os.Error { ch := make(chan os.Error) ptr := unsafe.Pointer(p) if ptr != nil { // Needs to run in separate go routine to safely lock the OS Thread // and synchronize via channel to know when we're done Thunk(func() { ch <- p.Provider().OkIf(C.zmq_term(ptr) == 0) }).RunInOSThread() // Wait for completion return <-ch } return nil }
func (c *Context) Close() { // C.NULL is correct but causes a runtime failure on darwin at present if c.c != nil /*C.NULL*/ { C.zmq_term(c.c) } }
func (c *zmqContext) Close() { C.zmq_term(c.c) }
func destroyZmqContext(c unsafe.Pointer) { C.zmq_term(c) }
func Term(context ZContext) os.Error { return handle(C.zmq_term(context.Ptr)) }