[erlang-questions] Polling a CNODE

Robert Raschke rtrlists@REDACTED
Mon Sep 3 18:56:56 CEST 2018


I don't have the docs in front of me at the moment, but if I remember
correctly you need to have the message receive loop running continuously,
which handles the inter Erlang node pings for you. You can then monitor the
C node from Elixir and get a message if a ping was not answered in a timely
fashion.

On Mon, 3 Sep 2018 13:27 Damien Towning, <connolly.damien@REDACTED> wrote:

> Hi Everyone,
>
> I have a cnode written in C that performs some complex geometrical
> operations. The code is non blocking but I am wondering what the best way
> is to establish a keep alive poll back as return time for the cnode could
> be anywhere from a few seconds to hours. The cnode on the Erlang side is in
> elixir but I think this is really more an Erlang question than an Elixir
> one. I have something like this
> on the Erlang/Elixir side
>
>  Nodex.Distributed.up()
>     {conn, pid} = Cnode.start_link(%{exec_path: "bin/brep" ,
> spawn_inactive_timeout: :infinity } )
>  Cnode.call(pid, msg  )
>
> And then something like this on the c code side
>
>  else if ( erl_match(erl_format("blah"),operation) ) {
>     std::vector<double> para(3);
>     ETERM *parameters = erl_element(2,emsg->msg);
>     para = list_to_vectors( parameters );
>     cylinder(para[0],para[1],para[2]);
>     response = erl_mk_int( geometry.currentIndex() );
>     erl_free_term(parameters);
>   }
>
> My code does not block and I can regularly send messages back. I am just
> not sure what to send back as a regular wake up call.
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180903/402328a0/attachment.htm>


More information about the erlang-questions mailing list