<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</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">> We could try resuming the old process. That would require detecting that a new UI process was created and terminate it. I don't like this, because it may be the new process the one that is doing relevant stuff now. Besides, this could
 lead to state corruption, depending (for example) on the state of method temp variables in both processes.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">> I think it is reasonable to state that the UI process, as the other system created processes are a bit special: The system needs to guarantee that there is always an UI process ready to run. This might mean the system messing with these
 processes occasionally. People wanting to have absolute control over processes should fork their own.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I've been thinking about it and yes, controlling two UIs is unreasonably complicated; a reasonable solution has to be simple and straightforward otherwise it's better leave as it is (I mean keep your great update #5347 keeping the UI always
 available for new exceptions).</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I've just tested one more approach in Squeak; the idea is: To keep the system responsive if the UI is blocked, start a new UI process in #newProcessIfUI: and let the old (blocked) one wait and eventually finish its *last cycle* and then
 automatically*terminate*; to make sure the old UI terminates automatically you could e.g. add a simple test to the #mainLoop</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#mainLoop</p>
<p class="MsoNormal">                </p>
<p class="MsoNormal">                self clearWaitDelay.</p>
<p class="MsoNormal">                canvas isNil ifTrue: [</p>
<p class="MsoNormal">                                self setMainCanvas ].</p>
<p class="MsoNormal">                self redrawNeeded.</p>
<p class="MsoNormal">                [</p>
<p class="MsoNormal">                                self doOneCycle.</p>
<p class="MsoNormal">                                UISupervisor uiProcess isActiveProcess ]    "<----- a test in the spirit of whether the active process really is the current UI process"</p>
<p class="MsoNormal">                                                whileTrue: []</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In Squeak this approach seems to work but Cuis has a different (a bit more complicated) implementation and I haven't managed to implement the idea correctly.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Does this sound like a reasonable approach or just another potential can of worms? :)</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Many thanks,</p>
<p class="MsoNormal">Jaromir</p>
<p class="MsoNormal"><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">+420 777 492 777</span><span style="font-family:"Calibri Light",sans-serif;color:#555555"><br>
</span><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="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From: </b><a href="mailto:JuanVuletich@zoho.com">Juan Vuletich</a><br>
<b>Sent: </b>Monday, July 4, 2022 17:11<br>
<b>To: </b><a href="mailto:cuis-dev@lists.cuis.st">Discussion of Cuis Smalltalk</a><br>
<b>Cc: </b><a href="mailto:mail@jaromir.net">Jaromir Matas</a><br>
<b>Subject: </b>Re: [Cuis-dev] FW: Freezing UI - can't interrupt via Alt+.</p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:black">On 7/3/2022 5:48 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">I hate to bring bad news but I’m afraid there’s still one outstanding issue ;)<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">Transcript cr; show: 'done'<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">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></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">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></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">Transcript cr; show: 'done'] 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">I look forward to hearing from you again, many thanks!<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">PS: I tried resuming instead of terminating the oldUIProcess but that of course ends up infamously with two UI processes ;)<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">Best,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Jaromir<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"><span style="color:black"><a href="mailto:mail@jaromir.net">mail@jaromir.net</a><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"><o:p> </o:p></span></p>
</blockquote>
<p class="MsoNormal"><span style="color:black"><br>
We could try resuming the old process. That would require detecting that a new UI process was created and terminate it. I don't like this, because it may be the new process the one that is doing relevant stuff now. Besides, this could lead to state corruption,
 depending (for example) on the state of method temp variables in both processes.<br>
<br>
I think it is reasonable to state that the UI process, as the other system created processes are a bit special: The system needs to guarantee that there is always an UI process ready to run. This might mean the system messing with these processes occasionally.
 People wanting to have absolute control over processes should fork their own.<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"><o:p> </o:p></span></p>
</div>
</body>
</html>