[zeromq-dev] Terminating context after fork

Matt Connolly matt.connolly at me.com
Sat Aug 31 13:33:36 CEST 2013


I’ve had a go at implementing support for terminating a context after fork (in the child process). My approach was to replace the inherited file descriptors in all signallers with new ones so that any signals sent between threads will not interfere with the parent process’s context.

The idea is that a user can safely terminate an inherited context.

Code review welcome: https://github.com/mattconnolly/zeromq3-x/commit/4fa9feab194d843537846b9cc1b1504535eb8fc7

Sample code that demonstrates the issue (asserts in zeromq, but works with the above commit).

I have a question though: When a socket is closed, does that actually send a “closing” message over the wire? If so, this could be problematic in that the child would be communicating the fact that it is closing the socket, but the parent could still have it open.

Regards,
Matt




More information about the zeromq-dev mailing list