rcp:cast/4 example?

andy allen recycledelectrons@REDACTED
Tue Mar 27 19:45:33 CEST 2001


Thanks for the advice, but no.

I want to make a call, without waiting for it to return. The reason I use 
cast instead of call is effeciency. Each (of cast and call) is a BIF (built 
in function,) and that all BIFs will block on the local node until it 
finished. I do not want to block at all. This is a Real Time application, 
with hundreds of threads running (an AXD301 in NGS4.0).

Andy Allen
EUS/SA/BA


>From: Siri Hansen <siri.hansen@REDACTED>
>To: andy allen <recycledelectrons@REDACTED>
>Subject: Re: rcp:cast/4 example?
>Date: Tue, 27 Mar 2001 17:34:14 +0100
>
>Hi Andy!
>
>I think you want to do rpc:call/4 instead of rpc:cast/4. cast is
>asyncronous!
>
>/siri
>
>andy allen wrote:
> >
> > Hi, all.
> >
> > I'm looking for advice on a simple example of rpc:cast/4.
> >
> > -=-=-
> >
> > I am trying to get the following code to execute:
> >
> > call_ch_nodes_to_get_data(DataToPassWithCall) ->
> >     ?SYS_DBG(int_if, "mlgAmsCpt:call_ch_nodes_to_Get_data(~w)~n",
> >              [DataToPassWithCall]),
> >
> >     ChNodes = get_ch_nodes(),
> >     ?SYS_DBG(int_if, "Found the following nodes: ~w ~n", [ChNodes]),
> >
> >     Module = mlgCpt,
> >     Function = trace_cast,
> >
> >     [ChNode | Rest] = ChNodes, % Temporary hack for one node
> >     ?SYS_DBG(int_if, "Will cast to the node ~w, module ~w, function
> >                       ~w with the parameters ~w ~n",
> >              [ChNode, Module, Function, [DataToPassWithCall]]),
> >
> >     X = rpc:cast(ChNode, Module, Function, [DataToPassWithCall]),
> >     ?SYS_DBG(int_if, "Result of cast: ~w ~n", [X]),
> >
> >     nnn.
> >
> > -=-=-
> >
> > SYS_DBG {mlgAmsCpt,680,int_if}, <0.20019.3> 27-Mar-2001 15:13:37.022072:
> > -- mlgAmsCpt:call_ch_nodes_to_Get_data ({{switch_dev_id, 1}, {channel,
> > all}})
> >
> > ChNodes = get_ch_nodes(), SYS_DBG {mlgAmsCpt,691,int_if}, <0.20019.3>
> > 27-Mar-2001 15:13:37.046248:
> > -- Found the following nodes: ['cp1-19@REDACTED']
> >
> > SYS_DBG {mlgAmsCpt,697,int_if}, <0.20019.3> 27-Mar-2001  
>15:13:37.048843:
> > -- Will cast to the node 'cp1-19@REDACTED', module mlgCpt, function 
>trace_call
> > with the parameters [{{switch_dev_id,1},{channel,all}}]
> >
> > SYS_DBG {mlgAmsCpt,701,int_if}, <0.20019.3> 27-Mar-2001  
>15:13:37.052683:
> > -- Result of cast: true
> >
> > -=-=-
> >
> > To make certain that the function I am casting to works, I can call it 
>with
> > the following line from an Erlang shell:
> >
> > mlgCpt:trace_call({{switch_dev_id, 1}, {channel, all}}).
> >
> > It executes past a "SYS_DBG" statement, then crashes. But when I cast to 
>it,
> > it should at least execute the "SYS_DBG" statement, right?
> >
> > -=-=-
> >
> > For the uninitiated:
> > 1. rpc is a library in the standard Erlang distribution,
> > 2. ?SYS_DBG is a macro that works like a printf.
> >
> > -=-=-
> >
> > Thanks for ANY help you can give me!
> >
> > Andy Allen
> > Ericsson, EUS/SA/BA
> >
> > P.S. Has anyone considered expanding the MAN pages with simple 
>hello-world
> > examples of each library call?
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at http://explorer.msn.com

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com




More information about the erlang-questions mailing list