Commit 39ad27c9 authored by Constantin Rack's avatar Constantin Rack Committed by GitHub

Merge pull request #2779 from bluca/thread_fixes

Problems: no documentation for new thread affinity and priority options, test_ctx_options only checks global DRAFT flag
parents bfbb4ff2 e5e83c53
...@@ -64,6 +64,8 @@ ZMQ_THREAD_PRIORITY: Set scheduling priority for I/O threads ...@@ -64,6 +64,8 @@ ZMQ_THREAD_PRIORITY: Set scheduling priority for I/O threads
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_THREAD_PRIORITY' argument sets scheduling priority for The 'ZMQ_THREAD_PRIORITY' argument sets scheduling priority for
internal context's thread pool. This option is not available on windows. internal context's thread pool. This option is not available on windows.
When the scheduler policy is SCHED_OTHER on Linux, the system call "nice"
will be used to set a priority of -20 (max priority).
Supported values for this option depend on chosen scheduling policy. Supported values for this option depend on chosen scheduling policy.
Details can be found in sched.h file, or at http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html. Details can be found in sched.h file, or at http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html.
This option only applies before creating any sockets on the context. This option only applies before creating any sockets on the context.
...@@ -72,6 +74,16 @@ This option only applies before creating any sockets on the context. ...@@ -72,6 +74,16 @@ This option only applies before creating any sockets on the context.
Default value:: -1 Default value:: -1
ZMQ_THREAD_AFFINITY: Set CPU affinity for I/O threads
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_THREAD_AFFINITY' argument sets CPU affinity for the internal
context's thread pool. This option is only supported on Linux.
This option only applies before creating any sockets on the context.
[horizontal]
Default value:: -1
ZMQ_MAX_MSGSZ: Set maximum message size ZMQ_MAX_MSGSZ: Set maximum message size
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_MAX_MSGSZ' argument sets the maximum allowed size The 'ZMQ_MAX_MSGSZ' argument sets the maximum allowed size
......
...@@ -81,7 +81,7 @@ void test_ctx_thread_opts(void* ctx) ...@@ -81,7 +81,7 @@ void test_ctx_thread_opts(void* ctx)
assert (rc == -1 && errno == EINVAL); assert (rc == -1 && errno == EINVAL);
rc = zmq_ctx_set(ctx, ZMQ_THREAD_PRIORITY, ZMQ_THREAD_PRIORITY_DFLT); rc = zmq_ctx_set(ctx, ZMQ_THREAD_PRIORITY, ZMQ_THREAD_PRIORITY_DFLT);
assert (rc == -1 && errno == EINVAL); assert (rc == -1 && errno == EINVAL);
#if ZMQ_BUILD_DRAFT_API #ifdef ZMQ_THREAD_AFFINITY
rc = zmq_ctx_set(ctx, ZMQ_THREAD_AFFINITY, ZMQ_THREAD_AFFINITY_DFLT); rc = zmq_ctx_set(ctx, ZMQ_THREAD_AFFINITY, ZMQ_THREAD_AFFINITY_DFLT);
assert (rc == -1 && errno == EINVAL); assert (rc == -1 && errno == EINVAL);
#endif #endif
...@@ -113,7 +113,7 @@ void test_ctx_thread_opts(void* ctx) ...@@ -113,7 +113,7 @@ void test_ctx_thread_opts(void* ctx)
} }
#if ZMQ_BUILD_DRAFT_API #ifdef ZMQ_THREAD_AFFINITY
// test affinity: // test affinity:
int cpu_affinity_test = (1 << 0); int cpu_affinity_test = (1 << 0);
...@@ -145,7 +145,7 @@ int main (void) ...@@ -145,7 +145,7 @@ int main (void)
#endif #endif
assert (zmq_ctx_get (ctx, ZMQ_IO_THREADS) == ZMQ_IO_THREADS_DFLT); assert (zmq_ctx_get (ctx, ZMQ_IO_THREADS) == ZMQ_IO_THREADS_DFLT);
assert (zmq_ctx_get (ctx, ZMQ_IPV6) == 0); assert (zmq_ctx_get (ctx, ZMQ_IPV6) == 0);
#if defined (ZMQ_BUILD_DRAFT_AP) #if defined (ZMQ_MSG_T_SIZE)
assert (zmq_ctx_get (ctx, ZMQ_MSG_T_SIZE) == sizeof (zmq_msg_t)); assert (zmq_ctx_get (ctx, ZMQ_MSG_T_SIZE) == sizeof (zmq_msg_t));
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment