% $Id: RThread.oz,v 1.1 2010/04/02 03:14:06 leavens Exp $ % Remote thread 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 %% Remote Thread abstraction %% Encapsulate the remote execution when no remote resources are used. %% P is an arbitrary nullary procedure executed in a remote thread. %% We're not interested in the remote module in this case. proc {RThread P} {R apply(functor define thread {P} end end _)} end end