[squeak-dev] Semaphore >> #terminateProcess
Marcel Taeumel
marcel.taeumel at hpi.de
Mon Jul 8 15:16:34 UTC 2019
Hi, there.
Is there a way to change Semaphore >> #terminateProcess that it would also terminate a process that has not run yet? Shout's background styling can leave many processes behind, waiting for semaphores that have long been forgotten. Here is a minimal example, extracted from Shout:
| m s |
m := Monitor new.
s := nil.
1000 timesRepeat: [
m critical: [
s ifNotNil: [s terminateProcess. s := nil] ].
m critical: [
s := Semaphore new.
[s wait] fork.
Processor yield "Important!"].
].
s terminateProcess.
***
After this code snipped, shouldn't be any new processes waiting for those semaphores... "Processor yield" is really necessary here...
Best,
Marcel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190708/73c80f85/attachment.html>
More information about the Squeak-dev
mailing list
|