Threads in LC

doc hawk dochawk at
Tue Jan 5 17:19:24 EST 2021

richard reminisced,

>I wonder if we can tailor an LC approach to more closely resemble it, or at very least arrive
>at a language feature proposal to give us parallelism within a single-thread like Python does.

I put some thought into this a few years ago.

It could begin with some not-quite-implemented language features and declarations.  (Perhaps “thread . . .” instead of “send”).

I also produced a master/slave pair of stacks.  Or, rather, a stack that acted differently when its filename started with “master” than with “slave”.

It was pretty straightforward to get them talking.

My intent was to have one running the application, and having the other send the Postgres requests.   However, with an open Postgres connection, things are fast enough that it turned out to be unnecessary.  (It also probably helped that I included a minimum delay from the last keyUp message before the “background” (by send in . . ) task would execute rather than kick itself down the clock a few seconds.

Anyway, the existing sockets might be expandable, allowing threads to essentially run their own instance of livecode and talk by message.

More information about the use-livecode mailing list