programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: More on Multi-tasking

From: Rick VanNorman <rvn_at_forth.com>
Date: Fri, 15 Oct 1999 08:16:40 -0700

>From: Jerry Avins <jya_at_ieee.org>

>> > 8192 task CheckKey
>> > : DoCheck CheckKey ACTIVATE
>> > BEGIN KEY? IF KEY [CHAR] p =
>> > IF ." p was pressed" THEN
>> > THEN
>> > 1000 SLEEP
>> > AGAIN ;
>> > DoCheck
>>

>Ahh! Life is simple when one knows the answers. Now that we understand
>why we can't do it, do you have an answer for how it can be done?

It depends on what you are trying to do. KEY in a task? Nah, not today.

8192 TASK THINKING

\ do a long calculation, then rest for an arbitrary period of time

: IMPLEMENT ( -- )
   THINKING ACTIVATE BEGIN
      WORRY WONDER AH-HA! PUBLISH
      1000 Sleep DROP
   AGAIN ;

\ do an extremely long calculation set, resting a little all the time

: ZZZ ( -- ) 10 Sleep DROP ;

: INVENT ( -- )
   THINKING ACTIVATE BEGIN
      100 0 DO
         WORRY ZZZ WONDER ZZZ AH-HA! ZZZ PUBLISH ZZZ
   AGAIN ;

Please note that if you want a task to do I/O (keyboard and/or display)
you would have to create a place for it to be done. I'll think about
an example of it...

Rick

.
Received on Fri Oct 15 1999 - 08:16:40 PDT

This archive was generated by hypermail 2.2.0 : Thu Nov 20 2008 - 03:04:28 PST