[zeromq-dev] Can zmq_socket be create in thread 1 and used by thread 2?
张凯
zhangkai.gis at 163.com
Wed May 6 06:59:50 CEST 2015
Hello,
The code looks like that
if(create_socket(&socket_control_rep, config->endpoint_control_rep, config->uuid_control_rep,
config->action_control_rep, config->type_control_rep, socket_ctx) != 0) rc = -1;
if(create_socket(&socket_terminal_manage_down, config->endpoint_terminal_manage_down, config->uuid_terminal_manage_down,
config->action_terminal_manage_down, config->type_terminal_manage_down, socket_ctx) != 0) rc = -1;
if(create_socket(&socket_control_down, config->endpoint_control_down, config->uuid_control_down,
config->action_control_down, config->type_control_down, socket_ctx) != 0) rc = -1;
.......
pthread_create(&thread_down, NULL, ServerDown, this);
In the thread thread_downI use the socket_control_rep socket_terminal_manage_down,socket_control_down, To receive message.
Thanks,
zhangkai
在 2015-05-06 10:51:39,"Ren, Wei (Nokia - CN/Hangzhou)" <wei.ren at nokia.com> 写道:
Hi
Could you please share your code?
It should be fine if only one thread touch the socket.
Brs
R.W.
+8618626888319
From:zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of ext ??
Sent: Wednesday, May 06, 2015 10:17 AM
To:zeromq-dev at lists.zeromq.org
Subject: [zeromq-dev] Can zmq_socket be create in thread 1 and used by thread 2?
Hello,
I knew that zmq_socket can not used in multi-thread.But Can I just create the socket in thread 1.Then use it in thread 2?Now I meet a problem.At first The sub can receive message.But when runs a few minutes.It can not receive message.I doubt It is because I create it in thread1 but use it in thread2.
Thanks,
zhangkai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150506/e1803c59/attachment.htm>
More information about the zeromq-dev
mailing list