gm2
[Top][All Lists]
Advanced

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

Re: Import procedure NEWPROCESS


From: Alexey Ulasevich
Subject: Re: Import procedure NEWPROCESS
Date: Thu, 3 Oct 2024 17:35:58 +0300
User-agent: Mozilla Thunderbird


03.10.2024 08:46, Jack Perry пишет:
...and judging from the modula-2 reference at

   https://www.modula2.org/reference/isomodules/isomodule.php?m=SYSTEM.DEF

....there is indeed no NEWPROCESS procedure in SYSTEM. If you are wedded to the ISO version, you may want to look at the Processes and Coroutines libraries.

It was also discovered by me. It works, but I expected other behavior. For example:

MODULE process_probe2;
FROM STextIO IMPORT WriteString, WriteLn;
FROM Processes IMPORT Start, StopMe, Parameter, ProcessId;
FROM libc IMPORT sleep;
VAR
PID1, PID2 : ProcessId;
PROCEDURE P1;
VAR
i: INTEGER;
BEGIN
FOR i := 1 TO 5 DO
WriteString("P1"); WriteLn;
sleep(1);
END;
StopMe();
END P1;
PROCEDURE P2;
VAR
i: INTEGER;
BEGIN
FOR i := 1 TO 5 DO
WriteString("P2"); WriteLn;
sleep(1);
END;
StopMe();
END P2;
BEGIN
Start(P1, 0, 0, NIL, PID1);
Start(P2, 0, 0, NIL, PID2);
END process_probe2.
I expected two processes work parallel.
But they work sequential in same thread. It's doesn't look like `multithreading`. :-)
Best regards,
Alexey Ulasevich


reply via email to

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