home .. forth .. colorforth mail list archive ..

[colorforth] multitasking


Hello,

Since there is no documentation of multitasking that I could find, I
thought I would report here what I found. Please correct anything you know
to be wrong.

First, there are two tasks. One is the primary task, and there is also a
background task. The background task that we are familer with is the one 
that redraws screen.

Each task has a return stack and data stack. For the primary task this is
gods and godd, and for the background task it is mains and maind. 

The background task is specified with the 'act' word. The act word takes
one parameter which seems to be the initial value for the top of the data
stack.

A simple test I did was the following:

: t 0 act begin pause end

Executing 't' seemed to replace the drawing task as I expected.

Switching between tasks is acomplished by the 'pause' word. It can be used
anywhere in your application to let background task execute. When the
background task is done it will execute 'pause' to give you back 
control. I tried this in my Mandelbrot Set, pausing after drawing each
scan line. It seemed to give the expected result.

Hope this was helpful.

Mark

------------------------

To Unsubscribe from this list, send mail to Mdaemon@xxxxxxxxxxxxxxxxxx with:
unsubscribe ColorForth
as the first and only line within the message body
Problems   -   List-Admin@xxxxxxxxxxxxxxxxxx
Main ColorForth site   -   http://www.colorforth.com