Fwd: simple proc_lib test example

jose joseerlang@REDACTED
Wed Jul 26 12:53:43 CEST 2006


launoja@REDACTED escribió:
> Copy for the Erlang list...
>
>
>   --- välitettävä viesti alkaa ---
>
> ------------------------------------------------------------------------
>
> Asunto:
> Re: simple proc_lib test example
> De:
> launoja@REDACTED
> Fecha:
> Wed, 26 Jul 2006 13:12:09 +0300
> Para:
> jm <jeffm@REDACTED>
>
> Para:
> jm <jeffm@REDACTED>
>
>
> You have to export the simple and await functions also. Otherwise 
> calls from proc_lib module can't access the functions.
>
> The compiler complains because of this. Simple cannot be called from 
> outside of module and ditto for await.
>
> On Wed, 26 Jul 2006 19:34:14 +1000
>  jm <jeffm@REDACTED> wrote:
>> Having some problems with the following program is simplified example 
>> based on something I'm trying to write,
>>
>> -module(test_proc).
>>
>> -export([go/0]).
>>
>> go() ->
>>   proc_lib:start_link(?MODULE, simple, [], infinity).
>>
>> simple() ->
>>   proc_lib:init_ack({ok, self()}),
>>   await().
>>
>> await() ->
>>   receive
>>     after 1000 ->
>>       exit({ok, timeout})
>>    end.
>>
>>
>> $ erlc test_proc.erl
>> ./test_proc.erl:21: Warning: function await/0 is unused
>> ./test_proc.erl:21: Warning: function simple/0 is unused
>>
>> It doesn't look good at this stage. Why does it say unused? await/0 
>> is call from simple and simple/0 from proc_lib:start_link. I can 
>> understand the latter though as it's call from proc_lib:start_link as 
>> a parameter. Ignoring this and continuing....
>>
>> $ erl
>> Erlang (BEAM) emulator version 5.4.8 [source] [hipe]
>>
>> Eshell V5.4.8  (abort with ^G)
>> 1> test_proc:go().
>> ** exited: {undef,[{test_proc,simple,[]},{proc_lib,init_p,5}]} **
>> 2>
>>
>> and this where it hits a wall. Most likely it a simple beginner's 
>> error. Anyone to point out the glaringly obvious to me?
>>
>> Also, are the any good examples of code floating around?
>>
>> Jeff.
>>
>
await functions also? I think not necessary .
Salu2 ;-)




More information about the erlang-questions mailing list