From da930314aafc6cc7b182f0bbfa8e06c0b743e62d Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 16 Feb 2012 10:08:47 +0900 Subject: Names of context options shortened Signed-off-by: Martin Sustrik --- doc/xs_setctxopt.txt | 12 ++++++------ include/xs.h | 4 ++-- src/ctx.cpp | 4 ++-- tests/max_sockets.cpp | 2 +- tests/reentrant.cpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/xs_setctxopt.txt b/doc/xs_setctxopt.txt index bc7d018..be7d06f 100644 --- a/doc/xs_setctxopt.txt +++ b/doc/xs_setctxopt.txt @@ -24,9 +24,9 @@ The 'option_len' argument is the size of the option value in bytes. The following options can be set with the _xs_setctxopt()_ function: -XS_CTX_MAX_SOCKETS: Set maximum number of sockets -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The 'XS_CTX_MAX_SOCKETS' option shall set specify the maximum nuber of sockets +XS_MAX_SOCKETS: Set maximum number of sockets +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The 'XS_MAX_SOCKETS' option shall set specify the maximum nuber of sockets that can be open at the same time. [horizontal] @@ -34,9 +34,9 @@ Option value type:: int Option value unit:: sockets Default value:: 512 -XS_CTX_REENTRANT: Specify whether sockets should be thread-safe -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If 'XS_CTX_REENTRANT' option is set to 1 it is safe to access single Crossroads +XS_REENTRANT: Specify whether sockets should be thread-safe +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +If 'XS_REENTRANT' option is set to 1 it is safe to access single Crossroads socket from multiple threads in parallel. If it is set to 0 it can be accessed by at most one thread at any single point of time. diff --git a/include/xs.h b/include/xs.h index 4d0be57..d536f19 100644 --- a/include/xs.h +++ b/include/xs.h @@ -146,8 +146,8 @@ XS_EXPORT int xs_getmsgopt (xs_msg_t *msg, int option, void *optval, /* Crossroads context definition. */ /******************************************************************************/ -#define XS_CTX_MAX_SOCKETS 1 -#define XS_CTX_REENTRANT 2 +#define XS_MAX_SOCKETS 1 +#define XS_REENTRANT 2 XS_EXPORT void *xs_init (int io_threads); XS_EXPORT int xs_term (void *context); diff --git a/src/ctx.cpp b/src/ctx.cpp index 917c3e6..c80a3c3 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -139,7 +139,7 @@ int xs::ctx_t::terminate () int xs::ctx_t::setctxopt (int option_, const void *optval_, size_t optvallen_) { switch (option_) { - case XS_CTX_MAX_SOCKETS: + case XS_MAX_SOCKETS: if (optvallen_ != sizeof (int) || *((int*) optval_) < 0) { errno = EINVAL; return -1; @@ -148,7 +148,7 @@ int xs::ctx_t::setctxopt (int option_, const void *optval_, size_t optvallen_) max_sockets = *((int*) optval_); opt_sync.unlock (); break; - case XS_CTX_REENTRANT: + case XS_REENTRANT: if (optvallen_ != sizeof (int) || (*((int*) optval_) != 0 && *((int*) optval_) != 1)) { errno = EINVAL; diff --git a/tests/max_sockets.cpp b/tests/max_sockets.cpp index 4ce6cb9..424e8b3 100644 --- a/tests/max_sockets.cpp +++ b/tests/max_sockets.cpp @@ -28,7 +28,7 @@ int XS_TEST_MAIN () void *ctx = xs_init (1); assert (ctx); int max_sockets = 1; - int rc = xs_setctxopt (ctx, XS_CTX_MAX_SOCKETS, &max_sockets, + int rc = xs_setctxopt (ctx, XS_MAX_SOCKETS, &max_sockets, sizeof (max_sockets)); assert (rc == 0); diff --git a/tests/reentrant.cpp b/tests/reentrant.cpp index a4b2760..2832b1e 100644 --- a/tests/reentrant.cpp +++ b/tests/reentrant.cpp @@ -28,7 +28,7 @@ int XS_TEST_MAIN () void *ctx = xs_init (1); assert (ctx); int val = 1; - int rc = xs_setctxopt (ctx, XS_CTX_REENTRANT, &val, sizeof (val)); + int rc = xs_setctxopt (ctx, XS_REENTRANT, &val, sizeof (val)); assert (rc == 0); // Do a set of operations to make sure that REENTRANT option doesn't -- cgit v1.2.3