Team, I am building a multi threaded application in linux with C as the programming language and use ZMQ_PAIR sockets for inter-thread communication (zmq version - 4.3.0). The main thread of the application communicates with external applications using router-dealer model.
The application process spawns multiple child threads for handling specific functionalities. Each thread creates two ZMQ_PAIR sockets (one for bind & the other for connect) and bind & connect these sockets to same end point (inproc://<unique-name-per-thread>). All these are done during process initialization and finally the threads invoke zmq_poll on the bind socket. The connect socket is only used for sending messages to the thread and the bind socket is used to receive them. The thread publishes APIs to other threads and messages are sent to the connect socket of the thread from these APIs (in non-blocking mode). Of course socket access (i.e, zmq_send) is mutex protected from application perspective. I've tested the application and its working fine so far without any issues. I understand that zmq socket is not thread safe and as you see, in this model, messages are sent to the connect socket from multiple threads (not concurrently anyway due to the mutex protection!). Do you think that sharing the socket in this way can cause any problem from zmq perspective? Please let me know if something is not clear or if you need more info. Thanks a lot for your help. Regards, Anand.
_______________________________________________ zeromq-dev mailing list [email protected] https://lists.zeromq.org/mailman/listinfo/zeromq-dev
