%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The definition of Guard % Authors: Peter Van Roy and Seif Haridi % May 9, 2003 functor import Fault export guard:Guard define proc {LocalWatcher E FS W S} {Fault.installWatcher E FS W _} try {S} finally {Fault.deInstallWatcher E W _} end end proc {Guard E FS S1 S2} N={NewName} T={Thread.this} proc {W E FS} {Thread.injectException T N} end in {Fault.enable E 'thread'(T) nil _} try {LocalWatcher E FS W S1} catch X then if X==N then {S2} else raise X end end end end end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%