An idea on multithreading implementation
Geoff Canyon Rev
gcanyon+rev at gmail.com
Fri Jan 28 02:18:02 CST 2011
The example given at wikipedia makes it obvious that this isn't true.
Coroutines are inherently stateful. Managing that by hand using wait 0 ticks
with messages is a disaster. I've done it.
As one brief example, suppose you have two lists that need to be processed
simultaneously. With coroutines you could use repeat for each line L in
whatever for each of the routines. With wait 0 ticks you would have to break
both lists up into arrays ahead of time or otherwise pay the performance
Yes, threading and coroutines are not the same things. There are advantages
to threads, but as has already been pointed out, there are significant
disadvantages as well. Coroutines would enable many techniques that today
are awkward or impossible, with seemingly minimal muss and fuss.
On Fri, Jan 28, 2011 at 1:16 AM, Jeffrey Massung <massung at gmail.com> wrote:
> On Jan 27, 2011, at 10:54 PM, Geoff Canyon Rev wrote:
> > I'd suggest coroutines: http://en.wikipedia.org/wiki/Coroutine
> > They have the advantage of being fairly similar to what some of us have
> > already with send.in to get this sort of behavior, and probably wouldn't
> > break existing syntax.
> Coroutines have absolutely no advantage over what's already provided by LC.
> There's zero difference between saying "yield()" and "wait 0 ticks with
> The purpose of mutli-threading is to take advantage of one or more of the
> following: a completely separate hardware thread (program/code runs 100% in
> parallel with another program/set of code - the only bottlenecks being
> memory and I/O) or preemptive threading, typically by way of hyper-threading
> on a single hardware thread (basically letting the hardware or OS decide
> when to context switch for you).
> Sorry. :-(
> Jeff M.
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the use-livecode