[futurebasic] Re: Yielding Processor

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

From: Victor Osimitz <perseus1@...>
Date: Mon, 27 Aug 56 23:28:53 -0000
>>While still learning about  the FBII environment, I'm developing a tool
>>that's pretty computationally intensive.  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? Does the DELAY command
>>yield the processor to other threads?
>
>The "preferred" approach is to fall into your event loop every so often,
>so the user can switch _your_ app to the background, or whatever. You do
>this generally by doing your computations on "null" events, perhaps while
>displaying a progress bar.
>
>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.
>
>The delay command does not yield the processor.

As I understand this, you just want to pause the computer so that it doesn't do anything for a period of time. This could be used for a number of things; if that's entirely wrong, stop reading this message right here.

In a game I had to write for school once, I paused the computer for about a second, supposedly while the thing was computing. The exact code I used was:

FOR x = 1 TO 100
   FOR y = 1 TO 100
      FOR z = 1 TO 100
      NEXT
   NEXT
NEXT

Basically, what that does is it does nothing else while the computer counts to one million. It takes 0.00000131 seconds to count to one, so to find out how high you should have the computer count, use this formula:

c = p รท 0.00000131

where p equals the amount of seconds you wish to pause and c equals the result (The number you should have the computer count to)

Hope this helps.


Victor Osimitz
Osimitz Solutions

- perseus1@...
- victor85@...

- http://www.geocities.com/Eureka/6153/

- DownloadTimer II: Calculate download times the easy way!! Send email to perseus1@... with a subject of "info-downloadtimer" for more information. Version 2.1 is now available!

- Web Design; contact me for more information