summaryrefslogtreecommitdiff
path: root/src/dispatcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dispatcher.cpp')
-rw-r--r--src/dispatcher.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/dispatcher.cpp b/src/dispatcher.cpp
index 51143b3..7115bca 100644
--- a/src/dispatcher.cpp
+++ b/src/dispatcher.cpp
@@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <new>
+
#include "../bindings/c/zmq.h"
#include "dispatcher.hpp"
@@ -49,7 +51,8 @@ zmq::dispatcher_t::dispatcher_t (int app_threads_, int io_threads_,
// Create application thread proxies.
for (int i = 0; i != app_threads_; i++) {
- app_thread_t *app_thread = new app_thread_t (this, i, flags_);
+ app_thread_t *app_thread = new (std::nothrow) app_thread_t (this, i,
+ flags_);
zmq_assert (app_thread);
app_threads.push_back (app_thread);
signalers.push_back (app_thread->get_signaler ());
@@ -57,15 +60,16 @@ zmq::dispatcher_t::dispatcher_t (int app_threads_, int io_threads_,
// Create I/O thread objects.
for (int i = 0; i != io_threads_; i++) {
- io_thread_t *io_thread = new io_thread_t (this, i + app_threads_,
- flags_);
+ io_thread_t *io_thread = new (std::nothrow) io_thread_t (this,
+ i + app_threads_, flags_);
zmq_assert (io_thread);
io_threads.push_back (io_thread);
signalers.push_back (io_thread->get_signaler ());
}
// Create command pipe matrix.
- command_pipes = new command_pipe_t [signalers.size () * signalers.size ()];
+ command_pipes = new (std::nothrow) command_pipe_t [signalers.size () *
+ signalers.size ()];
zmq_assert (command_pipes);
// Launch I/O threads.