[zeromq-dev] 0MQ - message lost and crash
Pieter Hintjens
ph at imatix.com
Fri Aug 20 10:57:19 CEST 2010
Hi Alfred,
Sorry for not responding immediately.
You're accessing the messageCount variable from two threads. That is
not safe and I'm pretty sure that's where your test gets confused.
The only safe way to send information from one thread to another is to
send a message. I'm writing a version of your code, in C, which does
this. You can try anyhow: use another pair of sockets, PUSH from the
recvThread and PULL in the main.
-Pieter
On Fri, Aug 20, 2010 at 10:08 AM, Wang Alfred <alfredwang1979 at gmail.com> wrote:
> Is there anyone can help on this problem?
>
> On Wed, Aug 18, 2010 at 6:11 PM, Wang Alfred <alfredwang1979 at gmail.com>
> wrote:
>>
>> Hi,
>> I'm trying to write a test program to test the performance of ZeroMQ, but
>> I encountered some problems.
>> The test uses 50 threads to send messages, each thread will sent 100
>> messages, and there is another thread for receiving messages. But I found
>> that I can not receive all messages, the total messages sent is 5000, but
>> the received is about 4300.
>> Another problem is that, if I use the tcp protocol, this test will crash.
>> I'm using C#, so I use the clrzmq http://www.zeromq.org/bindings:clr
>> I'm new to ZeroMQ, and form it's website, it claims to be thread safe if
>> all threads share one context, I think this test follows the guide. I
>> will appreciate it if someone can help to point out the problem, thanks.
>> I put the codes on http://pastebin.com/cPjKwKd2
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
--
-
Pieter Hintjens
iMatix - www.imatix.com
More information about the zeromq-dev
mailing list