1. A better delay()???
- Posted by Hawke <mdeland at NWINFO.NET> Aug 16, 1998
- 402 views
jiri babor wrote: > Hawke, my machine wants to know now what to do > with all those cycles saved while idling anyway... >jiri actually, that got me thinking... tis real bad thing to sit there and hog the processor like that... i find myself using ex.exe in multitasking environments quite frequently (ie:win95box for one) and in theory, we -should- return that busy wait back to the processor for it to do other things... just like wait_key() supposedly does. ===cut from library.doc=== --<wait_key()>-- ...You could achieve the same result using get_key() as follows: while 1 do k = get_key() if k != -1 then exit end if end while However, on multi-tasking systems like Windows, Windows NT, or OS/2 this "busy waiting" would slow the system down. wait_key() lets the operating system do other useful work while your program is waiting for the user to press a key.... ===end=== sooooooooooooooooooooooooo... how about a variant of Delay() that returns the processor back to the OS for the duration of the delay???? (let's not get overly complicated/submit unreadable code to solve this problem either...shall we? ;) ) take care--Hawke'