The message gets printed when you try to set a socket option on a socket after the thread (or another) has terminated the context. I'm not sure if printing the message is a good response... that could be fixed.
However it's not an error; it's a normal shutdown. One thread terminates the context and any blocking operation gets ETERM as a return code. Your code is perhaps not detecting ETERM properly. Can you post a minimal case that we can try? -Pieter On Sat, Aug 31, 2013 at 12:47 AM, Chris Laws <[email protected]> wrote: > 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 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 example > the "Context was terminated" error line is not produced. > > The second 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 > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
