#Task and Msgs
I have this little program. I'm trying to get two tasks to talk to each
other. I've tried every variation I can think of to fix this, and none of
them work. It manages to create the task and then guru's.
The listing for the program is:
MODULE t1;
FROM SYSTEM IMPORT
ADR, ADDRESS, BYTE, NULL, TSIZE, WORD;
FROM Ports IMPORT
Message, MessagePtr, MsgPortPtr, FindPort, WaitPort, GetMsg,
PutMsg, ReplyMsg;
FROM PortUtils IMPORT
CreatePort, DeletePort, CreateExtIO, DeleteExtIO;
FROM Tasks IMPORT
Task, TaskPtr, AddTask, FindTask, RemTask;
FROM Storage IMPORT
ALLOCATE, DEALLOCATE, CreateHeap, DestroyHeap;
FROM Memory IMPORT
AllocMem, FreeMem, MemReqSet, MemPublic, MemClear;
FROM Nodes IMPORT
NodeType;
FROM InOut IMPORT
WriteString, WriteLn;
FROM IO IMPORT
IORequest, IORequestPtr;
IMPORT Trapper;
TYPE
StackAreaType = ARRAY[0..2048] OF WORD;
taskproctype = PROCEDURE;
MyRequest = RECORD
mrReq : IORequest;
mrData : ARRAY[0..10] OF CHAR;
END;
MyRequestPtr = POINTER TO MyRequest;
VAR
Stack1, Stack2 : StackAreaType;
Task1, Task2 : TaskPtr;
i : LONGCARD;
pv1, pv2 : taskproctype;
Intercom : MsgPortPtr;
memreqs : MemReqSet;
MyData : ARRAY[0..20] OF CHAR;
MyMsg : MyRequestPtr;
quits : CARDINAL;
(*$P-*) PROCEDURE p1;
VAR
i : CARDINAL;
m : MyRequestPtr;
n : MessagePtr;
p : MsgPortPtr;
r : MsgPortPtr;
PROCEDURE WaitReply();
BEGIN
WHILE (GetMsg(r) = MessagePtr(0)) DO
n := WaitPort(r);
END;
END WaitReply;
<Continued next message>