1. 程式人生 > >7.2 錯誤處理-程序終止

7.2 錯誤處理-程序終止

-module(test).
-export([process/0, start/0]).
start() ->
    register(my_name, spawn(test, process, [])).
process() ->
    receive
         {stop, Method} ->
             case Method of
                  return ->
                      true;
                  Other ->
                      exit(normal)
             end;
         Other ->
             process()
    end.