/* * Document-method: new * * call-seq: * new(io_threads=1) * * Initializes a new 0MQ context. The io_threads argument specifies the size * of the 0MQ thread pool to handle I/O operations. If your application is * using only the _inproc_ transport for you may set this to zero; otherwise, * set it to at least one. */ static VALUE context_initialize (int argc_, VALUE* argv_, VALUE self_) { VALUE io_threads; rb_scan_args (argc_, argv_, "01", &io_threads); assert (!DATA_PTR (self_)); void *ctx = zmq_init (NIL_P (io_threads) ? 1 : NUM2INT (io_threads)); if (!ctx) { rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ())); return Qnil; } DATA_PTR (self_) = (void*) ctx; return self_; }