From 921da22147e201455837bcd38df1af33aceff26f Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Tue, 13 Mar 2012 11:10:33 +0100 Subject: io_threads argument removed from xs_init() The argument was changed to a context option (XS_IO_THREADS). 0MQ compatibility mode sets the option and ensures that there's at least one I/O thread present. Signed-off-by: Martin Sustrik --- src/xszmq.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/xszmq.cpp') diff --git a/src/xszmq.cpp b/src/xszmq.cpp index d97d9ea..6b3930c 100644 --- a/src/xszmq.cpp +++ b/src/xszmq.cpp @@ -112,7 +112,22 @@ size_t zmq_msg_size (zmq_msg_t *msg) void *zmq_init (int io_threads) { - return xs_init (io_threads); + void *ctx = xs_init (); + if (!ctx) + return NULL; + + // Crossroads don't allow for zero I/O threads. + if (io_threads < 1) + io_threads = 1; + + int rc = xs_setctxopt (ctx, XS_IO_THREADS, &io_threads, + sizeof (io_threads)); + if (rc != 0) { + xs_term (ctx); + return NULL; + } + + return ctx; } int zmq_term (void *context) -- cgit v1.2.3