From a5fefa3d5ba405deedba689b056959358048d935 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 5 Apr 2012 10:41:47 +0200 Subject: EMTHREAD error code removed libxs (as opposed to libzmq) requires at least one I/O thread per context. Thus, "no I/O thread available" error doesn't make sense anyome. This patch removes the code and the documentation. It keeps the definition of EMTHREAD itself for backward compatibility. Signed-off-by: Martin Sustrik --- doc/xs_bind.txt | 2 -- doc/xs_connect.txt | 2 -- include/xs.h | 3 ++- src/err.cpp | 2 -- src/socket_base.cpp | 10 ++-------- 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/doc/xs_bind.txt b/doc/xs_bind.txt index 8cd49bc..fc08124 100644 --- a/doc/xs_bind.txt +++ b/doc/xs_bind.txt @@ -60,8 +60,6 @@ The requested 'address' specifies a nonexistent interface. The 'context' associated with the specified 'socket' was terminated. *ENOTSOCK*:: The provided 'socket' was invalid. -*EMTHREAD*:: -No I/O thread is available to accomplish the task. EXAMPLE diff --git a/doc/xs_connect.txt b/doc/xs_connect.txt index a0a6ae7..898b915 100644 --- a/doc/xs_connect.txt +++ b/doc/xs_connect.txt @@ -58,8 +58,6 @@ The requested 'transport' protocol is not compatible with the socket type. The 'context' associated with the specified 'socket' was terminated. *ENOTSOCK*:: The provided 'socket' was invalid. -*EMTHREAD*:: -No I/O thread is available to accomplish the task. EXAMPLE diff --git a/include/xs.h b/include/xs.h index 6f0004c..e44587e 100644 --- a/include/xs.h +++ b/include/xs.h @@ -111,7 +111,8 @@ XS_EXPORT void xs_version (int *major, int *minor, int *patch); #define EFSM (XS_HAUSNUMERO + 51) #define ENOCOMPATPROTO (XS_HAUSNUMERO + 52) #define ETERM (XS_HAUSNUMERO + 53) -#define EMTHREAD (XS_HAUSNUMERO + 54) +#define EMTHREAD (XS_HAUSNUMERO + 54) /* Kept for backward compatibility. */ + /* Not used anymore. */ /* This function retrieves the errno as it is known to Crossroads library. */ /* The goal of this function is to make the code 100% portable, including */ diff --git a/src/err.cpp b/src/err.cpp index f05cf06..f9549ff 100644 --- a/src/err.cpp +++ b/src/err.cpp @@ -49,8 +49,6 @@ const char *xs::errno_to_string (int errno_) return "The protocol is not compatible with the socket type"; case ETERM: return "Context was terminated"; - case EMTHREAD: - return "No thread available"; default: #if defined _MSC_VER #pragma warning (push) diff --git a/src/socket_base.cpp b/src/socket_base.cpp index fbb3b5e..5b1752e 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -326,10 +326,7 @@ int xs::socket_base_t::bind (const char *addr_) // Remaining trasnports require to be run in an I/O thread, so at this // point we'll choose one. io_thread_t *thread = choose_io_thread (options.affinity); - if (!thread) { - errno = EMTHREAD; - return -1; - } + xs_assert (thread); if (protocol == "tcp") { tcp_listener_t *listener = new (std::nothrow) tcp_listener_t ( @@ -437,10 +434,7 @@ int xs::socket_base_t::connect (const char *addr_) // Choose the I/O thread to run the session in. io_thread_t *thread = choose_io_thread (options.affinity); - if (!thread) { - errno = EMTHREAD; - return -1; - } + xs_assert (thread); // Create session. session_base_t *session = session_base_t::create (thread, true, this, -- cgit v1.2.3