help-smalltalk
[Top][All Lists]
Advanced

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

[Help-smalltalk] Process & Fork


From: Quenio dos Santos
Subject: [Help-smalltalk] Process & Fork
Date: Sat, 20 Jul 2019 10:36:58 -0300

Hello,

I'm running the following program with two simple processes (the main one
and a forked process):

[
  | i |
  i := 0.
  [ true ] whileTrue: [
    i := i + 1.
    i displayNl.
    (Delay forSeconds: 1) wait
  ]
] fork.

[ true ] whileTrue: [
  Processor yield
]

I was expecting these two processes to run indefinitely, but the program
hangs after printing a few lines:

1
2
3

And then I have to interrupt it.

I'm wondering if there's something basic I'm missing here. Maybe I don't
understand how "Process yield" works, but I thought it was just going to
suspend the current process and let the forked process run.

Any help is appreciated,
    Quenio


reply via email to

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