Add a New Comment (Rich Markup)
Does a Ctrl-C reach LE runtime code at all to be able to close the socket / context and empty any remaining queue content at exit?
Better provide the full quote from the manual: Making a Clean Exit Classy programmers share the same motto as classy hit men: always clean-up when you finish the job. When you use ØMQ in a language like Python, stuff gets automatically freed for you. But when using C, you have to carefully free objects when you’ re finished with them or else you get memory leaks, unstable applications, and generally bad karma. Memory leaks are one thing, but ØMQ is quite finicky about how you exit an application. The reasons are technical and painful, but the upshot is that if you leave any sockets open, the zmq_ctx_destroy() function will hang forever. And even if you close all sockets, zmq_ctx_destroy() will by default wait forever if there are pending connects or sends unless you set the LINGER to zero on those sockets before closing them. The ØMQ objects we need to worry about are messages, sockets, and contexts. Luckily it’ s quite simple, at least in simple programs: • Use zmq_send() and zmq_recv() when you can, it avoids the need to work with zmq_msg_t objects. • If you do use zmq_msg_recv(), always release the received message as soon as you’ re done with it, by calling zmq_msg_close(). • If you are opening and closing a lot of sockets, that’ s probably a sign that you need to redesign your application. In some cases socket handles won’ t be freed until you destroy the context. • When you exit the program, close your sockets and then call zmq_ctx_destroy(). This destroys the context.
from the ZMQ manual: The ØMQ objects we need to worry about are messages, sockets, and contexts. Luckily it’ s quite simple, at least in simple programs: • Use zmq_send() and zmq_recv() when you can, it avoids the need to work with zmq_msg_t objects. • If you do use zmq_msg_recv(), always release the received message as soon as you’ re done with it, by calling zmq_msg_close(). • If you are opening and closing a lot of sockets, that’ s probably a sign that you need to redesign your application. In some cases socket handles won’ t be freed until you destroy the context. • When you exit the program, close your sockets and then call zmq_ctx_destroy(). This destroys the context. Summary: clean exits are only possible if not only the socket or the context is closed, but the corresponding queues are empty as well....
Programs using øMQ library does not react properly on a Ctrl-C. To quit they have to be killed. I suspect that øMq is replacing the standard handler set by SmartEiffel runtime
(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)
Attach Files: Comment:
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Only logged-in users can vote.
Please enter the title of George Orwell's famous dystopian book (it's a date):
Follow 5 latest changes.
Copyright © 2023 Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. The Levitating, Meditating, Flute-playing Gnu logo is a GNU GPL'ed image provided by the Nevrax Design Team. Source Code
Powered by Savane 3.12