home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 17951 < prev    next >
Encoding:
Text File  |  1992-12-30  |  2.2 KB  |  54 lines

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