zmqpp
zmqpp copied to clipboard
Graceful Handling of: Context closed
Hi Ben,
I'm currently playing around with the implications of manually destroying the zmqpp::context by calling zmq_ctx_destroy on it. Obviously this is not "normal" behavior, but rather a rare edge case. When you adopted zmq 3.2 you introduced zmqpp:: invalid_instance, which one might use for exactly this case: as there is no way to change the context of a poller / socket these should probably close themselves and throw that particular exception.
I would love to have your opinion on this, before preparing a pull request.
Cheers, Maximilian
If you have found a nice way to detect that the context has been destroyed then I'm more than happy to accept a pull request to make sockets throw a sensible exception when someone tries to use them.
We'd also have to handle anything in a blocked state, poll(), send(), recv() but all those should exit anyway once the context is gone so that bit should be straight forward.