diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2010-02-02 13:29:31 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-02-02 13:29:31 +0100 |
commit | 27e47bdcc0358b84a57378e19359556e2dbcb50e (patch) | |
tree | 9c61ad77cb2cbcf42ffa937e14b85095fc62bfac | |
parent | 5d16070ffcd426e81ea27520f6847d68e5e5af80 (diff) |
ZMQII-54: Affinity isn't honoured
-rw-r--r-- | src/dispatcher.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/dispatcher.cpp b/src/dispatcher.cpp index b830654..806866c 100644 --- a/src/dispatcher.cpp +++ b/src/dispatcher.cpp @@ -176,23 +176,22 @@ zmq::app_thread_t *zmq::dispatcher_t::choose_app_thread () return NULL; } -zmq::io_thread_t *zmq::dispatcher_t::choose_io_thread (uint64_t taskset_) +zmq::io_thread_t *zmq::dispatcher_t::choose_io_thread (uint64_t affinity_) { - zmq_assert (io_threads.size () > 0); - // Find the I/O thread with minimum load. - int min_load = io_threads [0]->get_load (); + zmq_assert (io_threads.size () > 0); + int min_load = -1; io_threads_t::size_type result = 0; - for (io_threads_t::size_type i = 1; i != io_threads.size (); i++) { - if (!taskset_ || (taskset_ & (uint64_t (1) << i))) { + for (io_threads_t::size_type i = 0; i != io_threads.size (); i++) { + if (!affinity_ || (affinity_ & (uint64_t (1) << i))) { int load = io_threads [i]->get_load (); - if (load < min_load) { + if (min_load == -1 || load < min_load) { min_load = load; result = i; } } } - + zmq_assert (min_load != -1); return io_threads [result]; } |