Re: [Pharo-dev] nil suspend

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

Re: [Pharo-dev] nil suspend

Nicolas Cellier
It sounds like a left over...
no time stamp in Squeak, so it must be old.
Display reverse; reverse means we wanted to catch when such oddity was necessary.
(I would do it differently with an Exception and a MessageTally like I already exhibited several times)
The fact that reverse; reverse was commented is more difficult to interpret... Is it really necessary?
I removed the method in a Squeak image, and so fare nothing wrong happened, but it does not prove anything.
The best is to ask in Squeak lists, maybe someone can remember...
Or carefully analyze all senders of suspend...

2017-11-18 22:36 GMT+01:00 Aliaksei Syrel <[hidden email]>:
Hi,

I was looking at nil (already funny) and found a very interesting method:

suspend
   "Kills off processes that didn't terminate properly"
   "Display reverse; reverse."  "<-- So we can catch the suspend bug"
   Processor terminateActive
It means that the following code is probably the shortest way to kill your image (save first!)

nil suspend
It terminates a UI process if evaluated from anywhere using CMD+d :D

Cheers,
Alex



Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] nil suspend

David T. Lewis
On Sat, Nov 18, 2017 at 11:04:32PM +0100, Nicolas Cellier wrote:

> It sounds like a left over...
> no time stamp in Squeak, so it must be old.
> Display reverse; reverse means we wanted to catch when such oddity was
> necessary.
> (I would do it differently with an Exception and a MessageTally like I
> already exhibited several times)
> The fact that reverse; reverse was commented is more difficult to
> interpret... Is it really necessary?
> I removed the method in a Squeak image, and so fare nothing wrong happened,
> but it does not prove anything.
> The best is to ask in Squeak lists, maybe someone can remember...
> Or carefully analyze all senders of suspend...
>
> 2017-11-18 22:36 GMT+01:00 Aliaksei Syrel <[hidden email]>:
>
> > Hi,
> >
> > I was looking at nil (already funny) and found a very interesting method:
> >
> > suspend
> >    "Kills off processes that didn't terminate properly"
> >    "Display reverse; reverse."  "<-- So we can catch the suspend bug"
> >    Processor terminateActive
> >
> > It means that the following code is probably the shortest way to kill your
> > image (save first!)
> >
> > nil suspend
> >
> > It terminates a UI process if evaluated from anywhere using CMD+d :D
> >
> > Cheers,
> > Alex
> >

In Squeak 1.13u (very early) we have:

UndefinedObject>>suspend
Processor terminateActive.
^ self


And in the latest Squeak trunk, we have:

UndefinedObject>>suspend
        "Kills off processes that didn't terminate properly"
        "Display reverse; reverse."  "<-- So we can catch the suspend bug"
        Processor terminateActive

Both versions of the method have no timestamp, which means that it has
not be modified in a long time.

My guess would be that someone was debugging process scheduling using Display
reverse a long time ago, and left that comment in place as a memory jogger in
case they wanted to use it again. Presumably the nil suspend happened after
some nasty path through the code that was being debugged at that time. Maybe
it was related to scheduling controller processes in MVC, which can be a bit
tricky at times.

Given that evaluating nil suspend will hang the image, this looks like a method
that may have outlived its usefulness ;-)

Dave


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] nil suspend

Bob Arning-2
In reply to this post by Nicolas Cellier

One clue might be that the code was copied from from another method (can't really tell which copied which). By version

**v1BlockContext methodsFor: 'private'
cannotReturn: arg
    "Kills off processes that didn't terminate properly"
    "Display reverse; reverse."  "<-- So we can catch the suspend bug"
    Processor terminateActive

**v1UndefinedObject methodsFor: 'dependents access'
suspend
    "Kills off processes that didn't terminate properly"
    "Display reverse; reverse."  "<-- So we can catch the suspend bug"
    Processor terminateActive

by version 1.22, #cannotReturn: had changed

*122BlockContext methodsFor: 'private' stamp: 'jm 9/18/97 21:40'
cannotReturn: result
    "The receiver tried to return result to a method context that no longer exists."

    DebuggerView
        openContext: thisContext
        label: 'Block cannot return'
        contents: thisContext shortStack.

On 11/18/17 5:04 PM, Nicolas Cellier wrote:
It sounds like a left over...
no time stamp in Squeak, so it must be old.
Display reverse; reverse means we wanted to catch when such oddity was necessary.
(I would do it differently with an Exception and a MessageTally like I already exhibited several times)
The fact that reverse; reverse was commented is more difficult to interpret... Is it really necessary?
I removed the method in a Squeak image, and so fare nothing wrong happened, but it does not prove anything.
The best is to ask in Squeak lists, maybe someone can remember...
Or carefully analyze all senders of suspend...

2017-11-18 22:36 GMT+01:00 Aliaksei Syrel <[hidden email]>:
Hi,

I was looking at nil (already funny) and found a very interesting method:

suspend
   "Kills off processes that didn't terminate properly"
   "Display reverse; reverse."  "<-- So we can catch the suspend bug"
   Processor terminateActive
It means that the following code is probably the shortest way to kill your image (save first!)

nil suspend
It terminates a UI process if evaluated from anywhere using CMD+d :D

Cheers,
Alex