, , , . Yaws HTTP-, Erlang. .yaws, , out/1. , .
. spawn_link , loop/1:
<erl>
out(_Arg) ->
process_flag(trap_exit, true),
Self = self(),
Pid = spawn_link(fun() -> my_business_logic(Self) end),
loop(Pid).
loop(Pid) ->
receive
{Pid, good} -> {html, "Good"};
{Pid, bad} -> {html, "Bad"};
{'EXIT', Pid, Reason} ->
[{status, 500},
{html, "internal server error"}]
end.
my_business_logic(Parent) ->
%% run your logic here, then send a message
Parent ! {self(), good}.
</erl>
, Pid , , . , , , , EXIT .
. HTTP-, , Erlang , out/1 , . , , , .
.yaws , . Erlang, Yaws , appmod Yaws, Yaws , Erlang. , Yaws Yaws.