[futurebasic] Re: Yielding Processor

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Fri, 05 Dec 1997 23:03:15 -0600
Keith wrote:
> I'd like to yield some of the
> processor back to other applications, so they can do their thing for a while
> before I continue. Is there an easy way to do this?

John replied:
> ...I think you can just use CALL SYSTEMTASK to give time to
> other processes.

and Pete replied:
> If you are in a loop or some such call "CALL SYSTEMTASK" once in a while

and Bill replied:
> Another way, if you _don't_ want the user to be able to switch out, but 
> want to allow, for example, a network app running in the background to go 
> get email (while remaining in the background) is to stick "CALL 
> SYSTEMTASK" in your computation loop. This is _only_ recommended if you 
> absolutely, positively, _must_ stay in the foreground.

I don't know how this rumor got started, but SYSTEMTASK simply won't do
the trick.  This can easily be verified by executing the following code,
while at the same time running some kinetically-active program (i.e.
something you can look at to tell if it's "going") in the background:

goal& = FN TICKCOUNT + 1200  '20-second delay

You'll notice that the other app "freezes" for 20 seconds, even though
we're calling SYSTEMTASK hundreds of times.  Now replace CALL SYSTEMTASK
with HANDLEEVENTS, and watch the difference.

SYSTEMTASK only gives time to desk accessories and device drivers--in
particular, it does _not_ give time to other applications.  On the other
hand, HANDLEEVENTS does so, and it will give time to other app's whether
they're in the foreground or the background.

- Rick