Hi,

I have a pool of threads that needs to send messages to a zmq socket. I was
creating the socket, connecting, sending the message and closing it for
each message, but it is for sure not an optimal usage of resources, since
if I create/close sockets too fast, zmq is not able do release them as fast
and I get the error: "too many open files (signaler.cpp 330)". Since I have
no control over those threads, I'm about to try the following solution:

1 - create a pool of connected sockets (REQ, inproc)
2 - when a client thread wants to send a message, it grabs a socket from
the pool
3 - the thread performs a send/recv
4 - the thread releases the socket (which will be again available in the
pool)

The question is: what should I do to make this multi-threaded usage of
sockets safe? Is it enough to guarantee that multiple threads do not
perform send/receive simultaneously?

Thanks,
Thiago
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to