lundi 22 décembre 2014

Issue with threads and ZeroMQsockets: May a secondary thread use the socket created by the main thread?

I'm getting the error:



terminating with uncaught exception of type zmq::error_t: Socket operation on non-socket



with this code:



auto p = theSocket;

theThread = new std::thread ( [p] () {
zmq::message_t request;
p->recv (&request);
} );


while having no issue with this one:



auto p = theSocket;

zmq::message_t request;
p->recv (&request);


Is it because only the thread that created the socket can use it in 0mq?


Thanks.


Aucun commentaire:

Enregistrer un commentaire