<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Folks,<br>
    <br>
    On 8/21/2021 2:22 PM, Phil B via Cuis-dev wrote:
    <blockquote
cite="mid:CAMJMOehq3Fu2YDz==vNhGrxLVtCod+mTP3oyfMcNPm7-Fudb6A@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div dir="ltr">Gerald,</div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Sat, Aug 21, 2021 at 9:04
            AM Gerald Klix via Cuis-dev <<a moz-do-not-send="true"
              href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin: 0px 0px 0px
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">Hi Hilaire,<br>
            <br>
            I only did a short static analysis<br>
            (a fancy word for looking at the code<br>
            and scratching your head).<br>
            <br>
            IHMO there's a race condition:<br>
            <br>
            WorldMorph>>#runLocalStepMethods<br>
            <br>
                    | stepMessage |<br>
                    [ stepList notEmpty and:<br>
                        [ stepList first scheduledTime <= nowTime ]]<br>
                            whileTrue: [<br>
                                    stepMessage _ stepList first.<br>
            <br>
            <br>
            This piece of code looks at the scheduleTime of the<br>
            heap's first element then actually retrieves<br>
            the first element.<br>
            While this happens the heap in stepList may<br>
            be changed by adding or removing elements.<br>
          </blockquote>
          <div><br>
          </div>
          <div>If that is the issue, I think there's a larger problem
            to be solved.  Morphic is inherently not thread safe
            so you're dealing with an intractable problem (short of
            re-architecting Morphic.)    Other than marking a morph for
            redraw, anything else touching Morphic from a background
            process needs to be wrapped in UISupervisor
            whenUIinSafeState: [].</div>
        </div>
      </div>
    </blockquote>
    <br>
    This is of course true!!!<br>
    Hilaire, if you are sending any message that alters Morphic state
    from a different process, follow Phil's advice. It might make things
    more complicated, as possibly your process would need to wait until
    that block is effectively run, possibly using a Semaphore.<br>
    <br>
    <blockquote
cite="mid:CAMJMOehq3Fu2YDz==vNhGrxLVtCod+mTP3oyfMcNPm7-Fudb6A@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin: 0px 0px 0px
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            <br>
            Please try the attached method and tell me if it helps.<br>
            <br>
            @Juan: Even if my change does not fix Hilaire's problem<br>
            the method should still be changed.<br>
            <br>
            <br>
            HTH,<br>
            <br>
            Gerald<br>
          </blockquote>
          <div><br>
          </div>
          <div>Thanks,</div>
          <div>Phil </div>
        </div>
      </div>
    </blockquote>
    <br>
    Thanks,<br>
    <pre class="moz-signature" cols="72">-- 
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a>
<a class="moz-txt-link-freetext" href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a class="moz-txt-link-freetext" href="https://github.com/jvuletich">https://github.com/jvuletich</a>
<a class="moz-txt-link-freetext" href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
@JuanVuletich</pre>
  </body>
</html>