<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;}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
        {mso-style-priority:1;
        margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.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" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi All,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I'd like to ask you to help me understand this: If you run the following example in the Workspace, the UI will freeze (Alt + . recoverable indeed)</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">s := Semaphore new.</p>
<p class="MsoNormal">[1/0. s signal] fork.</p>
<p class="MsoNormal">s wait</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The reason is obvious - the example runs inside the UI and hence the UI will start waiting on the semaphore s. At the same time the newly forked process will try to evaluate 1/0 and will request the UI to open a debugger but this won't
 happen because the UI is waiting on a semaphore.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Now the question: Why the system won't start the debugger in a new UI? There's no 'fundamental' reason why the UI should get stuck on a semaphore instead of taking care of the new error that occurred elsewhere in the meantime. Look at 
 #spawnNewProcessIfThisIsUI: : the method tries to make sure there's a running UI so that a new debugger can be opened in case the UI is missing or is suspended. It feels like the situation where the UI *is blocked* has been left off - and I can't figure out
 whether by omission or intentionally.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I've tried to modify it like this:</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">spawnNewProcessIfThisIsUI: suspendedProcess</p>
<p class="MsoNormal">                "Initialize a UI process if needed. Answer true if suspendedProcess was interrupted</p>
<p class="MsoNormal">                from a UI process."</p>
<p class="MsoNormal">                self uiProcess == suspendedProcess ifTrue: [</p>
<p class="MsoNormal">                                self spawnNewProcess.</p>
<p class="MsoNormal">                                ^true</p>
<p class="MsoNormal">                ].</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">                "Ensure that the UI process is running."</p>
<p class="MsoNormal">                self uiProcess</p>
<p class="MsoNormal">                                ifNil: [self spawnNewProcess]</p>
<p class="MsoNormal">                                ifNotNil: [:p | (p isSuspended or: [p isBlocked]) ifTrue: [     "<------- here's my change... or: [p isBlocked]"</p>
<p class="MsoNormal">                                                self restoreDisplay.</p>
<p class="MsoNormal">                                                self uiProcess resume]].</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">                ^false                    "no new process was created"</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">... and the example above no longer blocks the UI !</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I'm not saying this is a fix (I don't have any debugger/UI experience to fix it correctly); I'm just trying to demonstrate the functionality I'd like to achieve :) A real fix should maybe open a new UI instead of unblocking the existing
 one, I don't know…</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks very much for any input on this.</p>
<p class="MsoNormal">best,</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">mail@jaromir.net</span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>