I am learning zeromq and have built a small-ish application using czmq that
generally works well. However, when I shut it down using Ctrl+C, it prints
"Context was terminated" to standard out. I presume this indicates a
non-clean exit and I would like to fix this.

I have read the guide section about making a clean exit but still could not
resolve what appears to be a non-clean exit. I have searched the mailing
list and my Google-fu wasn't good enough to find an answer.

I think that the problem I'm seeing is related to attached threads. When I
remove the thread code from my application I don't see the problem.

I have created two small czmq based examples that demonstrate my problem.
The first <https://gist.github.com/claws/6394946#file-threads-example-c> is
as simple as I can make it. My real application is written using the
reactor pattern and users a timer to generate the ping message instead of a
crude sleep. By commenting out the sleep in the
first<https://gist.github.com/claws/6394946#file-threads-example-c>example
the "Context was terminated" error line is not produced.

The 
second<https://gist.github.com/claws/6394946#file-threads-example-loop-c>example
is more closely representative of my real application and again
demonstrates the problem. This example spawns a thread and uses the zloop
to handle events.

>From my investigations it appears that the non-clean shutdown is somehow
related to attached threads that use inproc sockets. For some reason these
are not exiting cleanly when the there is any waiting or polling involved
and the context is destroyed.

Are they any suggestions on how I can shutdown cleanly when using threads
and the event reactor style?
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to