Threading or similar in LiveCode

Dar Scott dsc at swcp.com
Fri Jul 20 16:57:06 EDT 2012


As others have mentioned you can use an event style or use 'open process'.  Unfortunately, the later does not (yet) have callbacks.  But, it has gotten a recent overhaul.  

You can do timing and polling with 'send'.

I encourage trying the event style.  Your contiguous script without a 'wait with messages' is your critical section.  This greatly simplifies interaction among tasks (what would be threads).  For example, if you build a queue, it is naturally task safe (what would be thread safe).

If you have a large computational task that needs to go on in the background, then consider 'open process'.  However, I have usually been able to break these up into repeated 'send' tasks.  That is often not quite as fast, but it avoids the second standalone.  

I have an old stack called A Primer on Message Mechanics that might help.  You can find it here:
http://pages.swcp.com/dsc/revstacks.html

Dar


On Jul 20, 2012, at 2:24 AM, Rod McCall wrote:

> Dear LiveCoders,
> 
> As I said in a previous email I am returning to LiveCode after a few
> years (well seven to be exact) so am a little rusty. Anyway right now
> we are implementing a car simulator environment of which we will use
> LiveCode as the control console for the simulation - at least that is
> the current plan. Am I right in thinking there is no equivalent to the
> Threading class that you find in Python? If so how do people implement
> something which is similar to this? I may have missed the info in the
> docs but a quick Google or scan of the RR website for anything
> resembling threading seems to yield very little.
> 
> If no such equivalent exists are there ways round this? For example
> using sub-stacks etc each one behaving like a "fake thread"?
> 
> Sorry if this seems a silly question but it has been a few years since
> I used LiveCode.
> 
> Kind regards,
> 
> rod
> 
> -- 
> Dr Rod McCall
> Researcher in in-car, mixed reality technology and gaming
> Interdisciplinary Centre for Security, Reliability and Trust
> University of Luxembourg
> Blog: www.rodmc.com twitter:rodlux
> Publications and Information available on my blog





More information about the use-livecode mailing list