Threads in LC
david.bovill at gmail.com
Fri Jan 8 06:25:22 EST 2021
I would find it very helpful if we would share some code in this “thread” about threads?
At the moment I have a need to break up a heavy indexing task on a LiveCode server into a series of smaller steps that execute asynchronously.
The web server receives a webhook notifying it that there is some new data that needs indexing, and should reply immediately notifying receipt of the webhook.
This is one of the “easy” cases Bob was referring too I think. But I’m not sure until I see and can test the code what the right approach is. Approaches could be:
1) In LiveCode server return “put” a response the after use wait / send in time to do indexing. Does this work and not lockup the server?
2) Schedule cron jobs with LiveCode
3) Use shell commands such as “at” to schedule a task at a future time.
4) Use tools that can manage spawning of LiveCode server pseudo-threads
While this example might be server centric, I suspect that many of the principles carry over to the desktop and it is the most common use case for a need for “threads”
On 8 Jan 2021, 10:32 +0000, Graham Samuel via use-livecode <use-livecode at lists.runrev.com>, wrote:
> On a purely personal note (does that make it OT?), I think I am beginning to accept, at a pretty advanced age, that just understanding LC coding is not really enough to get stuff done. Linux for example I have managed to avoid, and many other technologies… perhaps learning all this stuff is good use of one’s time in lockdown (I’m in the UK at the moment). Can’t spend all one’s time on the bike trainer…
> So, Richard, if you have time to expand a bit on Linux virtual directories, I’d be grateful. But only if you have time.
> > On 8 Jan 2021, at 07:19, Richard Gaskin via use-livecode <use-livecode at lists.runrev.com> wrote:
> > Peter Bogdanoff wrote:
> > > On Jan 7, 2021, at 3:07 PM, Richard Gaskin wrote:
> > >
> > > > Maybe.
> > > >
> > > > Does your Pi_gpio_output function use file I/O calls to the virtual
> > > > file system in /run, or call an LCB or external using a lower-level
> > > > interface for GPIO?
> > >
> > >
> > > Maybe. Maybe not. In spite of all events, this may be the most
> > > challenging, nay, inscrutable question I have seen this year.
> > From you I'll take that as a compliment. :)
> > If this is interesting I don't mind breaking that down for people who don't yet spend as much time on the Raspberry Pi. Linux virtual directories are a pretty nifty invention.
> > --
> > Richard Gaskin
> > Fourth World Systems
> > Software Design and Development for the Desktop, Mobile, and the Web
> > ____________________________________________________________________
> > Ambassador at FourthWorld.com http://www.FourthWorld.com
> 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