simple proc_lib test example

jm <>
Wed Jul 26 11:34:14 CEST 2006


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.




More information about the erlang-questions mailing list