[nanomsg] Re: threading guidelines, and is traditional unix single threaded mode possible?

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Fri, 27 Sep 2013 07:15:15 +0200

On 27/09/13 06:25, Jason E. Aten wrote:
My conclusion was that I should just keep it simple. I should just have
the parent process close all nn_sockets, fork, and then reopen them
after then fork. The only problem I see is that closing all nn_sockets
may be slow since they may linger for quite a while trying to finish
sending their queued data. If the parent can live with not finishing all
of its operations, then it could turn off the linger, abort pending
sends by closing, and fork without delay.

But it would be nice not to have to enforce a close of all nn_sockets in
order to fork. As above, this might be very slow if the parent was in
the middle of sending a bunch of data.

In theory it would be possible to have prep-to-fork handler check whether there are any sockets open and fail if not so. However, that would prevent classic fork+exec scenarios.

Martin

Other related posts: