[nanomsg] Re: How to Write a Language Binding for nanomsg

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Thu, 28 Mar 2013 21:22:30 +0100

Hi Paul,

The EINTR section looks subtle. I'm almost sure restarting the
function is usually not the right way.

The scenario I am referring to is as follows:

1. excution is stuck in a blocking function (nn_recv).
2. user presses Ctrl+C
3. signal handler (installed by the language runtime sets a 'terminate' flag
4. nanomsg returns from the blocking function with EINTR error
5. now the language runtime is in control
6. it sees the 'terminate' flag and shuts down the application

The restart in this scenario is necessary when other signal (not SIGINT) interrupt the blocking function.

Did you considered a mechanism to enumerate available protocols and
transports?

What would that be good for?

From the first glance it seems bindings can be fully
protocol and transport agnostic.

They are IMO. Transport is specified dynamically in the connection string. Protocol can be inferred from the socket type, which in turn is listed by nn_symbol() function.

Martin

Other related posts: