Quantcast
Channel: Active questions tagged zeromq - Stack Overflow
Viewing all articles
Browse latest Browse all 204

Moving cppzmq message_t to background thread

$
0
0

I have a receiver thread. I want to move the messages into a queue for background processors threads. To put it simply:

std::queue<zmq::message_t> qu;zmq::message_t msg;zmq::recv_result_t res = sock.recv(msg, zmq::recv_flags::none);qu.push(std::move(message));

I get an error:

include/zmq.hpp:745:5: note: declared here  745 |     message_t(const message_t &) ZMQ_DELETED_FUNCTION;

Even without std::move, it's still not working.

I understand that zmq::message_t are not supposed to be moved like that. What is the correct way of doing that (efficiently, without un needed copying)?

I would expect that message_t will hold the message data allocated on the heap, and that will be freed in the destructor of the message_t. In that case, I don't understand what is the issue here.


Viewing all articles
Browse latest Browse all 204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>