The Inbox: Kernel-jar.1381.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Kernel-jar.1381.mcz

commits-2
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-jar.1381.mcz

==================== Summary ====================

Name: Kernel-jar.1381
Author: jar
Time: 11 March 2021, 11:22:42.897307 am
UUID: 692824e3-388b-7a4c-98ca-03fcacdc8b37
Ancestors: Kernel-mt.1380

Fix a bug in Process #isTerminated and #isSuspended.

The issue has also shown recently on an issue http://forum.world.st/Bug-in-Process-gt-gt-terminate-Returning-from-unwind-contexts-td5127570.html where it was causing terminated processes remain in Process Browser (erroneously considering them not terminated).

The main threads discussing this are:

http://forum.world.st/The-Inbox-Kernel-jar-1376-mcz-td5127335.html#a5127336

http://forum.world.st/The-Inbox-Kernel-jar-1380-mcz-td5127524.html

=============== Diff against Kernel-mt.1380 ===============

Item was changed:
  ----- Method: Process>>isSuspended (in category 'testing') -----
  isSuspended
+ "A process is suspended if it has non-nil suspendedContext (e.g. new or
+ previously suspended with the suspend primitive) and is not terminated or
+ waiting in a scheduler or a semaphore queue (i.e. is not runnable or blocked)."
+
+ ^myList isNil
+ and: [suspendedContext notNil]
+ and: [self isTerminated not]!
- "A process is suspended if it has been suspended with the suspend primitive.
- It is distinguishable from the active process and a terminated process by
- having a non-nil suspendedContext that is either not the bottom context
- or has not reached its endPC."
- ^nil == myList
-  and: [nil ~~ suspendedContext
-  and: [suspendedContext isBottomContext
- ifTrue: [suspendedContext closure
- ifNil: [suspendedContext methodClass ~~ Process
- or: [suspendedContext selector ~~ #terminate]]
- ifNotNil: [suspendedContext pc < suspendedContext closure endPC]]
- ifFalse: [true]]]!

Item was changed:
  ----- Method: Process>>isTerminated (in category 'testing') -----
  isTerminated
  "Answer if the receiver is terminated, or at least terminating."
  self isActiveProcess ifTrue: [^ false].
  ^suspendedContext isNil
+  or: ["If the suspendedContext is the bottomContext and the pc is at the endPC,
+ then there is nothing more to do."
-  or: ["If the suspendedContext is the bottomContext it is the block in Process>>newProcess.
-   If so, and the pc is at the endPC, the block has already sent and returned
-   from value and there is nothing more to do."
  suspendedContext isBottomContext
+ and: [suspendedContext pc >= suspendedContext endPC
+ or: [suspendedContext closure isNil
+ and: [suspendedContext methodClass == Process
+ and: [suspendedContext selector == #terminate]]]]]!
- and: [suspendedContext closure
- ifNil: [suspendedContext methodClass == Process
- and: [suspendedContext selector == #terminate]]
- ifNotNil: [suspendedContext pc >= suspendedContext closure endPC]]]!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-jar.1381.mcz

Christoph Thiede
+1 on this change. If you want to act in an exemplary manner, it would be
great if you could submit a test case for this in ProcessTest in a new inbox
version by using the example you mentioned in [1]. :-)

Best,
Christoph

[1]
http://forum.world.st/The-Inbox-Kernel-jar-1376-mcz-tp5127335p5127336.html



-----
Carpe Squeak!
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html

Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-jar.1381.mcz

Jaromir Matas
> If you want to act in an exemplary manner, it would be
> great if you could submit a test case for this in ProcessTest in a new
> inbox
> version by using the example you mentioned in [1]. :-)

Submitted.

PS: The simple example in [1] didn't work as a test so I created a
no-nonsensical bottom context  for the test manually.
Thanks,



-----
^[^ Jaromir
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html

^[^ Jaromir
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-jar.1381.mcz

Christoph Thiede

LGTM :-)


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Jaromir Matas <[hidden email]>
Gesendet: Dienstag, 16. März 2021 23:56:57
An: [hidden email]
Betreff: Re: [squeak-dev] The Inbox: Kernel-jar.1381.mcz
 
> If you want to act in an exemplary manner, it would be
> great if you could submit a test case for this in ProcessTest in a new
> inbox
> version by using the example you mentioned in [1]. :-)

Submitted.

PS: The simple example in [1] didn't work as a test so I created a
no-nonsensical bottom context  for the test manually.
Thanks,



-----
^[^ Jaromir
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html



Carpe Squeak!