05.08.2014 Views

here - Stefan-Marr.de

here - Stefan-Marr.de

here - Stefan-Marr.de

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6. Evaluation: The OMOP as a Unifying Substrate<br />

1 ATActor = Domain (<br />

2 | process mailbox terminate |<br />

3<br />

4 processIncomingMessages = unenforced (<br />

5 | msg |<br />

6 msg := mailbox next .<br />

7 msg <strong>de</strong>liverPromise : msg send )<br />

8<br />

9 initialize = (<br />

10 mailbox := SharedQueue new .<br />

11 terminate := false .<br />

12 process := self spawnHere : [<br />

13 [ terminate ] whileFalse : [<br />

14 self processIncomingMessages ]] )<br />

15<br />

16 sendAsAsyncMessage : aSelector to: anObj<br />

17 with : anArgArray inLookupClass : cls = (<br />

18 | msg |<br />

19 msg := ATMessage new .<br />

20 msg setSelector : aSelector arguments : anArgArray .<br />

21 msg receiver : anObj lookupClass : cls .<br />

22 mailbox nextPut : msg .<br />

23 ^ msg promise )<br />

24<br />

25 requestExecOf : aSelector with : args<br />

26 on: anObj lookup : cls = unenforced (<br />

27 | msg |<br />

28 self == Domain currentDomain ifTrue : [<br />

29 ^ anObj performEnforced : aSelector<br />

30 withArguments : args inSuperclass : cls ].<br />

31<br />

32 ^ self sendAsAsyncMessage : aSelector<br />

33 to: anObj with : args inLookupClass : cls )<br />

34<br />

35 requestThreadResume : process = unenforced (<br />

36 ThreadResumptionDenied signal ) )<br />

Listing 6.7: Definition of the ATActor Domain for Event-Loop Actors<br />

156

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!