Path: utzoo!mnetor!uunet!ncc!alberta!att-ih!ihnp4!ucbvax!USU.BITNET!SLMYQ From: SLMYQ@USU.BITNET Newsgroups: comp.sys.amiga.tech Subject: Re: Friendly waiting (not hogging the CPU) Message-ID: <8804150348.AA26966@jade.berkeley.edu> Date: 15 Apr 88 03:46:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 35 >>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. > > Hmm, Does WaitTOF() free the CPU for other tasks? I never use it. Well if it doesn't, then Commodore has violates an Amiga standard! Somewhere in one of the Addison-Wesley manuals I think, it said that the VBlank handler keeps a list of tasks waiting with WaitTOF(), and it wakes them up when it gets a VBlank. You might want to try - just write a program to wait 60 seconds this way and try loading a big program. If it goes "gronk, gronk" then it's not hogging the CPU. If it goes "groooonk, groooonk" then it is. :) > 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. It's more powerful, possibly faster, asynchronous, and it can process lots of different requests at the same time. Nice. Except most of us just want to wait 5 seconds while the user finds out why the alien ate him for lunch. :) > 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? That would be great. In fact, if the big compiler compainies wanted to make it easy, they would just add some code into the stub for Delay() to check the input for 0. However, I understand that the stubs are created automatically, and it might not be that easy. Bryan Ford (SLMYQ@USU.BITNET)