[zeromq-dev] zmq_socket and threads

guolisen guolisen at gmail.com
Fri Jan 4 07:58:05 CET 2013

Hi, Nishant Mittal
zmq_close() is a asynchronous function, It means zmq_close does not close or release resource, but send a message to pipe, when zmq context receive this message will release socket resource.
So if your thread is detach thread, the thread data could release before zmq release.

At 2013-01-03 05:23:28,"Nishant Mittal" <nmittal at rblt.com> wrote:
I know that zmq_sockets are not thread safe. however, is it an issue if I ensure a socket is used ONLY by 1 thread at a time?

the reason is ...
1) my application creates 5 threads, does some calcs and then the threads exit
2) this is done every minute. so every minute 5 new threads are created.
3) I think i will run into a file descriptor issue if i create sockets inside the thread (every time the thread is launched). so planning to create 5 sockets when my application starts and then use 1 socket from 1 thread.

is this going to be an issue?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130104/91f8c797/attachment.htm>

More information about the zeromq-dev mailing list