gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] [GM2] Iso Module "Processes" - Bug report


From: Gaius Mulley
Subject: Re: [Gm2] [GM2] Iso Module "Processes" - Bug report
Date: Mon, 21 Mar 2016 14:08:00 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

"address@hidden" <address@hidden> writes:

> Hello Gaius, all,
>
> below please find some sample code on how to use the "Processes"
> module from the ISO libraries. In order to make it run, I had to fix
> some minor bugs in "Processes.mod". The diff, the complete
> "Processes.mod" and the complete test module are attached. 
>
> Compile with: 
>
> gm2 -lpth -g -o TestProcesses -fmakeall -fiso -flibs=iso,pim
> TestProcesses.mod
>
> Tested on Ubuntu 14.4 64 bit on Intel Hardware. 
>
> Feel free to use the code in any way you find appropriate, I do not
> claim any rights on it.
>
> Thanks and regards, Georg
>
> MODULE TestProcesses;
>
> TYPE ParameterRec=RECORD
> Card:CARDINAL;
> Chars:ARRAY[0..20] OF CHAR;
> Parent:ProcessId;
> END;
> TYPE ParameterPtr=POINTER TO ParameterRec; 
>
> PROCEDURE Hello();
> VAR ChildId:ProcessId;
> DataPtr:ParameterPtr;
> Para:Parameter;
> BEGIN
> Log("Hello Client");
> ChildId:=Me();
> LogP2("ProcessId of Child is ",ChildId);
> Para:=MyParam();
> LogP1("Parameter address in Child ",Para);
> DataPtr:=CAST(ParameterPtr,Para);
> Log("Did the cast");
> IF DataPtr=NIL
> THEN
> Log("Param is nil");
> HALT;
> END; 
> (* Use current parameter values *)
> WriteString(DataPtr^.Chars);
> WriteLn();
> WriteCard(DataPtr^.Card,10);
> WriteLn();
> DataPtr^.Card:=27; (* Change a value *)
> SuspendMeAndActivate(DataPtr^.Parent); (* without patch: Assert failed
> *)
> END Hello;
>
> VAR ChildId:ProcessId;
> Data:ParameterRec;
> DataPtr:Parameter;
> BEGIN
> Log("Starting Test");
> Data.Parent:=Me();
> LogP2("Id of parrent ",Data.Parent);
> Data.Card:=42;
> Data.Chars:="This is Data ";
> DataPtr:=ADR(Data);
> LogP1("Parameter address in Parent ",DataPtr);
> Start(Hello,100000,10,DataPtr,ChildId);
> LogP2("Returned. Id of Child ",ChildId);
> WriteString("Parameter value in Parent ");
> WriteCard(Data.Card,10);
> WriteLn();
> END TestProcesses.

Hi Georg,

thanks for the test code and patch.  Test code for ISO processes is rare
in the gm2 testsuite - so the addition is very welcome!

regards,
Gaius



reply via email to

[Prev in Thread] Current Thread [Next in Thread]