Skip to content

Instantly share code, notes, and snippets.

-module(multi_try).
-export([dothese/1]).
dothese(FuncArray) ->
Me = self(),
lists:foreach(fun(F) -> spawn(fun() -> F(Me) end) end, FuncArray),
spawn(fun() -> timer:sleep(1000), Me ! timeout end),
Result = get_result("",length(FuncArray)),
io:format("result: ~p~n", [Result]).