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

  • From: "Jason E. Aten" <j.e.aten@xxxxxxxxx>
  • To: nanomsg <nanomsg@xxxxxxxxxxxxx>
  • Date: Mon, 23 Sep 2013 13:44:30 -0700

Are there guidelines for controlling how threads are used behind-the-scenes
in nanomsg?  Is it possible to have a single-threaded process (traditional
unix style) and still be running nanomsg in it by calling a
maintenance/event loop function every once in while?

I'm experimenting with an architecture that would involving multiple
forking of a process image that has a nanomsg publisher in process (with no
exec afterwards).

Obviously fork doesn't play well with multiple threads; i.e. won't work if
there isn't a way to either a) keep nanomsg always running on the single
one thread in the process; or b) ask all nanomsg threads to take a lunch
break (e.g. synchronize on a barrier, and maybe sigsetjump) until we fork
and then tell nanomsg to resume.

Even if neither of these is possible, I would still be interested in
guidance on how to manage threads in nanomsg.

Thanks!

Jason

Other related posts: