-module(wxenv). -export([inici/0, init/0, get/0, fi/0]). inici() -> register(?MODULE, spawn(wxenv, init, [])). get() -> wxenv!{get, self()}, receive {wxenv, E} -> E end. fi() -> wxenv!fi. init() -> wx:new(), E = wx:get_env(), loop(E). loop(E) -> receive {get, CallerPid} -> CallerPid!{wxenv, E}, loop(E); fi -> io:format("Procés wxenv finalitzat~n"), ok; _ -> loop(E) end.