help-smalltalk
[Top][All Lists]
Advanced

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

Re: Processes


From: address@hidden
Subject: Re: Processes
Date: Tue, 26 Jan 2021 18:06:22 +0100 (CET)

All,

The first program 

$ cat tst.st 
" Ref: Blue Book pg. 266 
  This program works. Type gst tst.st at the Linux 
  prompt and find out for yourself.
"
[[true] whileTrue: [
        (Time now) printNl . 
        (Delay forSeconds: 1) wait
        ] 
] value
 
continues forever for me (until I control-C stop gst) and prints the current 
time every second.

The second program
 
$ cat tstX.st
" Ref: Blue Book pg. 266 
  This program doesn't work. Type gst tstX.st at the Linux 
  prompt and find out for yourself.
"
[[true] whileTrue: [
        (Time now) printNl . 
        (Delay forSeconds: 1) wait
        ] 
]fork

Just prints one line (the current time) (1 line) and then exits for me.

However it is perhaps not a bad idea to try to add a Delay forSeconds:10 wait 
after the fork in the main process.

If the main process waits another 10 seconds, then it prints 10 lines for me, I 
just added a line after the fork:

fork.
(Delay forSeconds:10) wait

Also I suppose it is possible to wait for the forked process itself so that it 
continues indefinitely.

The problem is that the main process has exited and so the forked process is 
also gone.

However if the main GST process keeps around, then the above second program 
also works.

Regards,
David Stes


----- Op 26 jan 2021 om 13:20 schreef Mark Bratcher mdbratch@gmail.com:

> Hi Holger
> 
> I tried Gary’s test samples on 3.2.91 and it exhibits the same behavior as
> 3.2.5.
> 
> Mark
> 
> Sent from [ https://go.microsoft.com/fwlink/?LinkId=550986 | Mail ] for 
> Windows
> 10
> 
> From: [ mailto:holger@freyther.de | Holger Freyther ]
> Sent: Tuesday, January 26, 2021 2:12 AM
> To: [ mailto:gary.highberger@gmail.com | Gary Highberger ]
> Cc: [ mailto:help-smalltalk@gnu.org | help-smalltalk ]
> Subject: Re: Processes
> 
> Hi Gary!
> 
> How did you get GNU Smalltalk 3.2.5? On the surface this sounds like a problem
> already fixed[1] in the development branch of GNU Smalltalk? Could you try to
> cherry-pick this[1] and see if the problem persists?
> 
> thank you
> 
> holger
> 
> [1]
> http://git.savannah.gnu.org/cgit/smalltalk.git/commit/?id=72ada189aba0283c551ead16635c1983968080b8
> 
>> On 26. Jan 2021, at 10:53, Gary Highberger <gary.highberger@gmail.com> wrote:
> 
>> 
> 
>> Hi Help-Smalltalk,
> 
>> 
> 
>> If processes aren't supported in 3.2.5 then read no further :-)
> 
>> 
> 
>> Forks or Delays might be broken in 3.2.5. I totally hope I'm wrong or that
> 
>> there's a clean workaround.
> 
>> 
> 
>> For what I can tell, Forked* infinite loop processes containing a Delay
> 
>> won't run.*
> 
>> 
> 
>> Links to two Smalltalk programs based on an infinite loop, Delay, fork,
> 
>> example from the Bluebook follow:
> 
>> 
> 
>> https://www.dropbox.com/s/rs4iobnhh6vzmc4/tst.st?dl=0
> 
>> 
> 
>> https://www.dropbox.com/s/0zybbef44e45w3c/tstX.st?dl=0
> 
>> 
> 
>> At the Linux prompt enter gst tst.st to observe desired behavior.
> 
>> 
> 
>> At the Linux prompt enter gst tstX.st to see the failed fork behavior.
> 
>> 
> 
>> Any help you can provide will be greatly appreciated!
> 
>> 
> 
>> Thank you,
> 
>> 
> 
> > Gary Highberger



reply via email to

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