<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Calibri Light";
        panose-1:2 15 3 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
        {mso-style-priority:1;
        margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Juan,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I hate to bring bad news but I’m afraid there’s still one outstanding issue ;)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">s := Semaphore new.<o:p></o:p></p>
<p class="MsoNormal">[1/0. s signal] fork.<o:p></o:p></p>
<p class="MsoNormal">s wait.<o:p></o:p></p>
<p class="MsoNormal">Transcript cr; show: 'done'<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If you terminate a blocked UI it means it won’t be able to continue when signaled and won’t print ‘done’ in this case.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This feels like a natural requirement for the blocked UI to continue because if it was just a regular non-UI process we would want it continue too, I guess; like this:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">[s := Semaphore new.<o:p></o:p></p>
<p class="MsoNormal">[1/0. s signal] fork.<o:p></o:p></p>
<p class="MsoNormal">s wait.<o:p></o:p></p>
<p class="MsoNormal">Transcript cr; show: 'done'] fork<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I look forward to hearing from you again, many thanks!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">PS: I tried resuming instead of terminating the oldUIProcess but that of course ends up infamously with two UI processes ;)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best,<o:p></o:p></p>
<p class="MsoNormal">Jaromir<o:p></o:p></p>
<p class="MsoNoSpacing"><span lang="CS">--</span></p>
<p class="MsoNoSpacing"><strong><span style="font-family:"Calibri Light",sans-serif;color:#333333;font-weight:normal">Jaromír Matas</span></strong><span style="font-family:"Calibri Light",sans-serif;color:#555555"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><span style="font-family:"Calibri Light",sans-serif;color:#2E75B6">mail@jaromir.net</span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From: </b><a href="mailto:JuanVuletich@zoho.com">Juan Vuletich</a><br>
<b>Sent: </b>Saturday, July 2, 2022 21:55<br>
<b>To: </b><a href="mailto:cuis-dev@lists.cuis.st">Discussion of Cuis Smalltalk</a><br>
<b>Cc: </b><a href="mailto:JuanVuletich@zoho.com">Juan Vuletich</a>; <a href="mailto:mail@jaromir.net">
Jaromir Matas</a><br>
<b>Subject: </b>Re: [Cuis-dev] Freezing UI - can't interrupt via Alt+.<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:black">Hi Jaromir,<br>
<br>
I think it is fair to say that if the debugger needs to open, there must be a runnable UI process. Just pushed #5347 for that.<br>
<br>
I just think that nobody in the Cuis / Squeak community thought about that before.<br>
<br>
Thanks!!!<br>
<br>
Cheers,<br>
<br>
On 7/2/2022 6:03 AM, Jaromir Matas via Cuis-dev wrote: <o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Hi Juan,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">the update indeed works, thanks! <o:p>
</o:p></span></p>
<p class="MsoNormal"><span style="color:black">An observation though: if you do:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">1) Semaphore new wait<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">2) Alt+.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">3) Proceed<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">It disrupts the screen and 'restore display' from the World menu is needed; nothing serious, just reporting because I don't know whether this is to be expected or not :)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">There's one issue I'd very much like to discuss:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">s := Semaphore new.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">[1/0. s signal] fork.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">s wait<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">When I first ran this example I kind of hoped the UI would not freeze and would open a debugger on the ZeroDivide. I can't see any reason why not behave like that but both Squeak and Cuis freeze because the UI
 waits on the semaphore and the forked process requests the UI to open a debugger but the UI is stuck at the semaphore :)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">My expectation was the system would spawn a new UI that would open the debugger but I have no experience with UIs and debuggers and can imagine it may be very tricky :)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">I'd be very interested in your opinion how the above example could/should be handled by the UI.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Of course if you run the example in a non-UI process it works as expected but it'd be nice I guess if running it in the UI would behave similarly :)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">[s := Semaphore new.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">[1/0. s signal] fork.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">s wait] fork<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Many thanks!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Jaromir<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNoSpacing"><span lang="CS" style="color:black">--</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><strong><span style="font-family:"Calibri Light",sans-serif;font-weight:normal">Jaromír Matas</span></strong><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><a href="mailto:mail@jaromir.net">mail@jaromir.net</a><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;border-color:rgb(225,
          225, 225) -moz-use-text-color -moz-use-text-color">
<p class="MsoNormal"><b><span style="color:black">From: </span></b><a href="mailto:JuanVuletich@zoho.com">Juan Vuletich</a><span style="color:black"><br>
<b>Sent: </b>Saturday, July 2, 2022 1:54<br>
<b>To: </b></span><a href="mailto:cuis-dev@lists.cuis.st">Discussion of Cuis Smalltalk</a><span style="color:black"><br>
<b>Cc: </b></span><a href="mailto:JuanVuletich@zoho.com">Juan Vuletich</a><span style="color:black">;
</span><a href="mailto:mail@jaromir.net">Jaromir Matas</a><span style="color:black"><br>
<b>Subject: </b>Re: [Cuis-dev] Freezing UI - can't interrupt via Alt+.<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">On 7/1/2022 9:45 AM, Juan Vuletich via Cuis-dev wrote:
<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">On 7/1/2022 8:17 AM, Jaromir Matas via Cuis-dev wrote:
<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Hi Juan, all,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">I wonder why this can’t be interrupted by Alt+.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Semaphore new wait<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">The system returns a message “Can not interrupt background process” and the image has to be closed.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">The same happens in this case:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">s := Semaphore new.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">[1/0. s signal] fork.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">s wait<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">It not only freezes the UI but is not even recoverable…<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">jaromir<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNoSpacing"><span lang="CS" style="color:black">--</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><strong><span style="font-family:"Calibri Light",sans-serif;font-weight:normal">Jaromír Matas</span></strong><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><a href="mailto:mail@jaromir.net">mail@jaromir.net</a><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:black"><br>
Hi Jaromir,<br>
<br>
The problem is in #handleUserInterrupt, in particular in #processTakingMostCPU. #handleUserInterrupt runs on a high priority process, so the first thing it needs to figure out is which process to interrupt. I wrote that code believing that alt+. would need
 to interrupt busy code, and it works in that case. It doesn't work if the UI process is waiting and never resumed, as it is not "busy".<br>
<br>
We need to do better here. I won't be able to work on this for the next few days, but would be very happy if any of you folks suggest / code a solution.<br>
<br>
Thanks,<br>
<br>
<o:p></o:p></span></p>
<pre>-- </pre>
<pre>Juan Vuletich</pre>
<pre><a href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a></pre>
<pre><a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a></pre>
<pre><a href="https://github.com/jvuletich">https://github.com/jvuletich</a></pre>
<pre><a href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a></pre>
<pre><a href="https://independent.academia.edu/JuanVuletich">https://independent.academia.edu/JuanVuletich</a></pre>
<pre><a href="https://www.researchgate.net/profile/Juan-Vuletich">https://www.researchgate.net/profile/Juan-Vuletich</a></pre>
<pre><a href="https://patents.justia.com/inventor/juan-manuel-vuletich">https://patents.justia.com/inventor/juan-manuel-vuletich</a></pre>
<pre><a href="https://twitter.com/JuanVuletich">https://twitter.com/JuanVuletich</a></pre>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:black"><br>
Just pushed a fix. Please review it. It is update #5346.<br>
<br>
Thanks!<br>
<br>
<o:p></o:p></span></p>
<pre>-- </pre>
<pre>Juan Vuletich</pre>
<pre><a href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a></pre>
<pre><a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a></pre>
<pre><a href="https://github.com/jvuletich">https://github.com/jvuletich</a></pre>
<pre><a href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a></pre>
<pre><a href="https://independent.academia.edu/JuanVuletich">https://independent.academia.edu/JuanVuletich</a></pre>
<pre><a href="https://www.researchgate.net/profile/Juan-Vuletich">https://www.researchgate.net/profile/Juan-Vuletich</a></pre>
<pre><a href="https://patents.justia.com/inventor/juan-manuel-vuletich">https://patents.justia.com/inventor/juan-manuel-vuletich</a></pre>
<pre><a href="https://twitter.com/JuanVuletich">https://twitter.com/JuanVuletich</a></pre>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><span style="color:black"><o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:black"><br>
<br>
<o:p></o:p></span></p>
<pre>-- </pre>
<pre>Juan Vuletich</pre>
<pre><a href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a></pre>
<pre><a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a></pre>
<pre><a href="https://github.com/jvuletich">https://github.com/jvuletich</a></pre>
<pre><a href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a></pre>
<pre><a href="https://independent.academia.edu/JuanVuletich">https://independent.academia.edu/JuanVuletich</a></pre>
<pre><a href="https://www.researchgate.net/profile/Juan-Vuletich">https://www.researchgate.net/profile/Juan-Vuletich</a></pre>
<pre><a href="https://patents.justia.com/inventor/juan-manuel-vuletich">https://patents.justia.com/inventor/juan-manuel-vuletich</a></pre>
<pre><a href="https://twitter.com/JuanVuletich">https://twitter.com/JuanVuletich</a></pre>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>