Article View: comp.sys.amiga.tech
Article #8477Re: Frienndly waiting (not hogging the CPU) [WaitTOF???]
From: Wade Bickel
Date: Wed, 13 Apr 1988 09:37
Date: Wed, 13 Apr 1988 09:37
46 lines
2235 bytes
2235 bytes
SLMYQ@USU.BITNET writes:
>> I was wondering if there was a friendly way for an amiga Process to
>>Sleep for a period of time (in C). Currently to sleep for say,
>>1 second I do a
>>
>>for(i=0;i<50;i++)
>> WaitTOF();
>>
>>Is there a better, possibly more precise way of waiting for a period
>>of time without hogging the CPU.
>
> [Deleted explanation of Delay]
>
>You might want to open up the timer.device directly, but the only advantage
>this would give is you could do something else while it's "ticking" - it's
>asynchronous. You can use this method within tasks as well as processes,
>but if you just want a synchronous wait within a task, using WaitTOF()
>is probably better.
>
>>Thanks
>>-Roger
>
> Bryan
Hmm, Does WaitTOF() free the CPU for other tasks? I never use it.
If you can arrange to never be drawing into the current displayed bitmap
you should never need it, which is what I do.
I think the timer device is the way to go. Set up the timer to
genrate a software interrupt to restart your task. There are dozens
of ways to construct such a setup, depending on your needs and the
accuracy of the timing desired. This will be more complicated but will
allow much more flexable control of the system.
Good Luck,
Wade.
PS: If Delay() does indeed cause damage to disks if a 0 is passed
wouldn't it make sense to either not use it or encapuslate
it within a procedure which ensures a non-zero input?
UUCP: {cbosgd, hplabs!hp-sdd, sdcsvax, nosc}!crash!pnet01!haitex
ARPA: crash!pnet01!haitex@nosc.mil
INET: haitex@pnet01.CTS.COM
Technical Details
Message-ID:
<2814@crash.cts.com>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ucsd!sdcsvax!ucsdhub!jack!crash!pnet01!haitexShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ucsd!sdcsvax!ucsdhub!jack!crash!pnet01!haitex From: haitex@pnet01.cts.com (Wade Bickel) Newsgroups: comp.sys.amiga.tech Subject: Re: Frienndly waiting (not hogging the CPU) [WaitTOF???] Message-ID: <2814@crash.cts.com> Date: 13 Apr 88 09:37:44 GMT Sender: news@crash.cts.com Organization: People-Net [pnet01], El Cajon CA Lines: 45