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