[erlang-questions] Polling a CNODE

Damien Towning connolly.damien@REDACTED
Mon Sep 3 13:27:04 CEST 2018


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180903/89b5ba74/attachment.htm>


More information about the erlang-questions mailing list