Halt doesn't stop

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

Halt doesn't stop

mechanic
Following Squeak + Robots, introducing a 'self halt' statement into a method
definition and expecting the program execution to stop and a debug window to
open. That window opens but the execution of the method continues, so in the
repeating pattern example I end up with three or four small 'pre debug
windows' I think they're called, and the pattern is drawn as it would be
without any such halt statement. Why wouldn't the program stop execution
when the halt statement is reached? That seems to be what the book
describes.



--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Halt doesn't stop

Christoph Thiede

Hi Chris,


usually, 'self halt' stops the execution of the current process indeed, as you can try out by typing the following into a workspace and doing it:


self halt.

self inform: 'Hello world'


You will see that you need to proceed the debugger window in order to get the Hello World message.


However, Squeak also supports multiprocessing, and it is possible that any code or tool you are using executes your method each time in a separate process. Here is a simple example of multiprocessing:


[self halt] fork.

self inform: 'Hello world'


You can see that the debugger opens, but the Hello World message is shown at the same time. This is because the #fork message created a new process that is running parallel to the first process. The halt message then only interrupts this second process.


I don't know your exact code and tools, but that seems a logical explanation to me. If you use a tool that enforces multiprocessing, you might take a look at the Semaphore class to synchronize the different method executions.


I hope I understood your issue correctly, have much fun with Squeak!


Best,

Christoph




Von: Beginners <[hidden email]> im Auftrag von mechanic <[hidden email]>
Gesendet: Sonntag, 20. Oktober 2019 17:10 Uhr
An: [hidden email]
Betreff: [Newbies] Halt doesn't stop
 
Following Squeak + Robots, introducing a 'self halt' statement into a method
definition and expecting the program execution to stop and a debug window to
open. That window opens but the execution of the method continues, so in the
repeating pattern example I end up with three or four small 'pre debug
windows' I think they're called, and the pattern is drawn as it would be
without any such halt statement. Why wouldn't the program stop execution
when the halt statement is reached? That seems to be what the book
describes.



--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Halt doesn't stop

mechanic
Thanks Christoph, detailed response interleaved below.


Christoph Thiede wrote
> Hi Chris,
>
> usually, 'self halt' stops the execution of the current process indeed, as
> you can try out by typing the following into a workspace and doing it:
>
> self halt.
>
> self inform: 'Hello world'

On this system, the 'Hello World' message appears at the same time as the
error window triggered by the 'halt' message.


> You will see that you need to proceed the debugger window in order to get
> the Hello World message.
>
> However, Squeak also supports multiprocessing, and it is possible that any
> code or tool you are using executes your method each time in a separate
> process. Here is a simple example of multiprocessing:
>
> [self halt] fork.
>
> self inform: 'Hello world'
>
>
> You can see that the debugger opens, but the Hello World message is shown
> at the same time. This is because the #fork message created a new process
> that is running parallel to the first process. The halt message then only
> interrupts this second process.

Yes, that's what happens.


> I don't know your exact code and tools, but that seems a logical
> explanation to me. If you use a tool that enforces multiprocessing, you
> might take a look at the Semaphore class to synchronize the different
> method executions.

 
Hmm, that looks a bit deep for me at the moment. I suppose this is just one
of the inconsistencies that come out when following the Robots book. Pity
the image pointed to on the apress website isn't entirely consistent with
the pdf text on there.


> I hope I understood your issue correctly, have much fun with Squeak!
>
> Best,
>
> Christoph





--
Sent from: http://forum.world.st/Squeak-Beginners-f107673.html
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners