[Cuis-dev] Strange behavior with stepping
Phil B
pbpublist at gmail.com
Sat Aug 21 10:22:13 PDT 2021
Gerald,
On Sat, Aug 21, 2021 at 9:04 AM Gerald Klix via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:
> Hi Hilaire,
>
> I only did a short static analysis
> (a fancy word for looking at the code
> and scratching your head).
>
> IHMO there's a race condition:
>
> WorldMorph>>#runLocalStepMethods
>
> | stepMessage |
> [ stepList notEmpty and:
> [ stepList first scheduledTime <= nowTime ]]
> whileTrue: [
> stepMessage _ stepList first.
>
>
> This piece of code looks at the scheduleTime of the
> heap's first element then actually retrieves
> the first element.
> While this happens the heap in stepList may
> be changed by adding or removing elements.
>
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: [].
> Please try the attached method and tell me if it helps.
>
> @Juan: Even if my change does not fix Hilaire's problem
> the method should still be changed.
>
>
> HTH,
>
> Gerald
>
Thanks,
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210821/c6dbc571/attachment.htm>
More information about the Cuis-dev
mailing list