[REBOL] Re: Multiple Threads Crash
From: sanghabum:aol at: 24-Jul-2001 14:41
[Holger--rebol--com] writes:
> > The code below is something I started writing to get a feel for Rebol's
> > undocumented concurrent and muti-threading capabilities, and to verify
> where
> > and what sort of serialisation code I need to build into my
applications.
> Calling 'wait from within an awake handler is not really supported. It is
> bad style anyway, because in event-driven systems event handlers are not
> allowed to block.
<snip>
Thanks for the detail reply, Holger.
I appreciate the design problems, but let me make a "business case" for
needing to issue a wait within a VID action facet.
I'm developing an application that has "forward" and "backward" buttons to
move the user through a structured set of panels. But some users have very
slow machines and some panels need an appreciable amount of time to display.
So (after consulting the list: "[REBOL] Re: Interrupting an action") I added
a "Break" button and put a wait 0 & check for Cancel-requested Flag in the
Forward and Backward buttons' action facets.
It was then I realised that my "forward" and "backward" buttons could be
pressed repeatedly with each initiating a concurrent action. As they were all
competing to update a common panel the results got visually
interesting--though operationally useless. I added an "in use" flag to block
the unwanted threads and wrote the code that started this List Thread as a
way of exploring the behavior in a simplified form.
The operational code appears to work fine. At any one time there is only one
action facet updating the panel, with frequent "wait 0" and checks on the
Cancel-requested Flag. If this code is suspect for the reasons you give, can
you suggest another, perhaps more Rebelious, approach?
--Thanks,
--Colin.