% $Id: RemoteFun.oz,v 1.1 2010/04/02 14:44:03 leavens Exp leavens $ % Remote function abstraction % using transparent distribution to exploit dual-core processors. % % AUTHOR: Peter Van Roy declare local %% Create a second OS process accessed through remote module manager R. %% {R apply(F ?M)} will execute functor F in the second process and %% return the module M. The second process will execute on the %% second core of a dual core machine (if the OS is smart). R={New Remote.manager init(fork:sh)} in %% Second abstraction: remote function %% Takes any one-argument function F %% and convert it into a remote function execution. fun {RemoteFun F} fun {$ X} M={R apply(functor export res:Res define Res={F X} end $)} in M.res end end end