asynchronous actions????

Dar Scott dsc at swcp.com
Tue May 13 10:34:06 EDT 2003


On Tuesday, May 13, 2003, at 08:27 AM, sean nicholas harper wrote:

> my program runs the same shell script like 30 times. The script takes a
> while to execute (like 40 seconds). It seems to me that there should 
> be a
> way to have my processes execute asynchronously - something like 
> fork().
>
> Any ideas?

There are a couple ways to go.

1
If you are running only one script in the background, then you can 
sprinkle the code with this:

wait 1 milliseconds with messages

(You might be able to do this with more if you don't care what order 
they finish in or if they are not doing any communications I/O, but I 
like the second method so much I won't get into that)

2
Rethink your problem into state changes made by calling one or more 
handlers (without @ parameters).  Use the send command in your script:

send "processRow a, b" to me in 0

Also look at pendingMessages and cancel.  The later can be important in 
canceling a background task, however, often a flag works just fine, too.

Dar Scott





More information about the use-livecode mailing list