home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!gatech!concert!samba!usenet
- From: Todd_Lewis@unc.edu (Todd M. Lewis)
- Subject: Re: Simple C question
- Message-ID: <1992Dec30.140640.9571@samba.oit.unc.edu>
- Sender: usenet@samba.oit.unc.edu
- Nntp-Posting-Host: guitar.oit.unc.edu
- Organization: UNC Office of Information Technology
- References: <C02JCH.pC@ccu.umanitoba.ca>
- Date: Wed, 30 Dec 1992 14:06:40 GMT
- Lines: 41
-
- In article <C02JCH.pC@ccu.umanitoba.ca> umbadiu0@ccu.umanitoba.ca (Ted Babiuk)
- writes:
- >A have a main program which creates a child task using createtask()....
- >The child task runs TO FASSST! (its a color cycling routine....)
-
- Yes, those little tasks can really scream. (And you didn't even
- have to throw out the OS to do it. :-)
-
- >I've tried using a Delay(x) or wait(x) function to slow it down and make
- >it delay/wait...but this either stops the task entirely (no cycling
- >occures?...strange.....with Delay(10) i believe....) or crashes the
- >system....:(...
-
- That's because you are a Task, not a DOS Process. Delay() is
- a DOS function, and wait() is built on top of Delay() I think...
-
- >I've been able to do it with a loop as follows:
- > for (count=0;count<8000;count++);
- > cycle colors....etc.
- >BUT this takes processor time.....
- ..which is a evil thing to do. Stay away from that.
-
- >I could use the timer.device to do a timed wait but...
- >there must be an easier way.....
-
- Actually the timer.device is pretty easy to use. About eight lines
- of code would take care of it for you. Sorry I don't have an example
- handy right now.
-
- >Is there something simular to a sleep() command which puts a task to sleep
- >for 'x' ticks? (and uses little/no cpu time?)
-
- Since you are color-cycling, you probably want something tied to
- the video system anyway. Why not just throw in a couple of WaitTOF();
- calls? They will guarantee you at least one frame update delay
- per call, and there is very little overhead. You have to have
- the graphics library open, but it sounds like you already do.
- --
- _/_/_/ _/ Todd_Lewis@unc.edu You can lead a horse to
- _/ _/ utoddl@guitar.oit.unc.edu Mohammad, but you can't make
- _/ _/_/_/ a mountain drink a mole hill.
-