home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / amiga / programm / 15488 < prev    next >
Encoding:
Text File  |  1992-11-08  |  2.2 KB  |  52 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!ukma!usenet.ins.cwru.edu!agate!ames!elroy.jpl.nasa.gov!jato!jdickson
  3. From: jdickson@jato.jpl.nasa.gov (Jeff Dickson)
  4. Subject: Re: How to program multi-threaded programs on Amiga ?
  5. Message-ID: <1992Nov6.233056.24803@jato.jpl.nasa.gov>
  6. Organization: Jet Propulsion Laboratory
  7. References: <36604@cbmvax.commodore.com> <RNlXr*DG7@garfield.fipnet.fi>
  8. Date: Fri, 6 Nov 1992 23:30:56 GMT
  9. Lines: 41
  10.  
  11. In article <RNlXr*DG7@garfield.fipnet.fi> vsaari@garfield.fipnet.fi (Ville Saari) writes:
  12. >Randell Jesup (jesup@cbmvax.commodore.com) wrote:
  13. >
  14. >:     It's farily easy to start a subroutine as a process under 2.0 using
  15. >: CreateNewProc() with NP_Entry.  There are a few things to watch out for
  16. >: (setting up global data pointers, and handling of library bases), but it's
  17. >: pretty easy.  Make sure the sub-process exits before the main process!
  18. >
  19. >I have couple of questions about CreateNewProc():
  20. >
  21. >What is the right way for sub-process to exit and how can the main process
  22. >be absolutely sure the sub-process has exited?
  23. >
  24. >--
  25. > Ville Saari                 vsaari@garfield.fipnet.fi  ___     ____
  26. > Tallbergin puistotie 7 B 21 .---.                     //_  // //_//
  27. > 00200 Helsinki              -/O\- +358 0 682 2226    //   // //
  28. > FINLAND                      ---
  29.  
  30.     I'll give this a go - although after my "Software Interrupts and
  31. Semaphore" inquiry...I suspect that my creditability is shot. 
  32.  
  33. >What is the right way for sub-process to exit
  34.  
  35. In C, an exit call, returning from the main program, or letting your program's
  36. execution fall to the final closing brace. In assembler, restoring the initial
  37. set of registers and performing an RTS. 
  38.  
  39.         MOVEM.L (SP)+,d2-d7/a2-a7
  40.         RTS
  41.  
  42. >how can the main process be absolutely sure the sub-process has exited?
  43.  
  44. I believe CreateNewProc() has a hook function known as NP_EXIT. You could
  45. install a function here that would signal the main process of its death. 
  46. Another way (although quite nasty) would be to perform a Forbid, then signal
  47. the main process and die. The Forbid would be broken when the process died
  48. and the main process could rest assured that when it checked the signal and
  49. it was set - the child process really had died.
  50.  
  51. jeff
  52.