home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / amiga / programm / 16164 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  2.3 KB

  1. Path: sparky!uunet!ogicse!flop.ENGR.ORST.EDU!gaia.ucs.orst.edu!umn.edu!csus.edu!nextnet!wittb
  2. From: wittb@nextnet.csus.edu (brian witt)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: How to program multi-threaded programs on Amiga ?
  5. Message-ID: <1992Nov21.063015.20289@csus.edu>
  6. Date: 21 Nov 92 06:30:15 GMT
  7. Article-I.D.: csus.1992Nov21.063015.20289
  8. References: <1992Nov9.185443.2011@jato.jpl.nasa.gov> <1992Nov12.195317.19859@csus.edu> <83755@ut-emx.uucp>
  9. Sender: news@csus.edu
  10. Organization: California State University Sacramento
  11. Lines: 39
  12.  
  13. In article <83755@ut-emx.uucp> amigamat@ccwf.cc.utexas.edu (Mark Thomas) writes:
  14. >In article <1992Nov12.195317.19859@csus.edu> wittb@nextnet.csus.edu (brian witt) writes:
  15. >>    At exit time, send the low priorty process a kill message.
  16. >>    Then loop with a sleep() call until some global varaible is
  17. >>    set to indicate OK to die.
  18. >
  19. >Why not just have the sub-process reply back to you when it is okay
  20. >to quit?
  21. >I like for the OS to handle telling me a change in state.
  22.  
  23. Picture a higher priority task in a busy loop waiting for a variable
  24. (some flag) to change.  This higher priority task is not calling any
  25. OS functions.  Amiga Exec (1.3) does not lower the priority of a
  26. compute-bound process. (The scheduler is a soft-realtime system.) 
  27.  
  28. The flag variable can only be changed by lower priority process that
  29. is being starved out of CPU time.  The variable can't be set since
  30. the lower priority process never executes...  :-(
  31.  
  32. In SimCity, the Simulator is run at a lower priority.  When the user
  33. wants to quit I set a "better finish up" variable.  The user interface
  34. portion enters a loop of:
  35.     while( ! sim_has_exited ) Sleep(40L);
  36.  
  37. This gives the simulator a chance to actually get to a check.  Then
  38. it Forbid()s, sets the variable and exits.  I could have used a RemTask()
  39. since the simulator owns no resources, but while debugging, it was
  40. printf() (eg, ADOS Write()s) to a debug window...
  41.  
  42. >>   Brian Witt   Sac State Computer Science]   "Waldo, the pariot, is dead"
  43. >         Mark A. Thomas          / (amigamat@ccwf.cc.utexas.edu)
  44.  
  45. --- brian
  46.  
  47. -- 
  48. ============================================================================= !
  49.    Brian Witt   Sac State Computer Science]   "Waldo, the pariot, is dead"
  50.    Internet:  wittb@cube01.ccs.csus.edu               -- Agent Cooper
  51.                 #define  POSIX_ME_HARDER     1       <-- GNU
  52.