home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / amiga / programm / 15484 < prev    next >
Encoding:
Internet Message Format  |  1992-11-08  |  1.6 KB

  1. Path: sparky!uunet!cbmvax!jesup
  2. From: jesup@cbmvax.commodore.com (Randell Jesup)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: How to program multi-threaded programs on Amiga ?
  5. Message-ID: <36778@cbmvax.commodore.com>
  6. Date: 6 Nov 92 22:18:40 GMT
  7. References: <36604@cbmvax.commodore.com> <RNlXr*DG7@garfield.fipnet.fi>
  8. Reply-To: jesup@cbmvax.commodore.com (Randell Jesup)
  9. Organization: Commodore, West Chester, PA
  10. Lines: 33
  11.  
  12. vsaari@garfield.fipnet.fi (Ville Saari) writes:
  13. >Randell Jesup (jesup@cbmvax.commodore.com) wrote:
  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. >What is the right way for sub-process to exit and how can the main process
  20. >be absolutely sure the sub-process has exited?
  21.  
  22.     There are any number of ways.  Most of them some sort of notification
  23. combined with Forbid().  For example:
  24.  
  25. void
  26. myproc ()
  27. {
  28.     ...
  29.     Forbid();
  30.     Signal(parent,sig);    // tell parent we exited
  31. }
  32.  
  33.     The Forbid() is needed to ensure that the parent doesn't unload
  34. before the child finishes exiting (think about the case of the parent having
  35. higher priority to understand why).
  36.  
  37.     You can also use messages, or shared global variables, etc, etc.
  38.  
  39. -- 
  40. To be or not to be = 0xff
  41. -
  42. Randell Jesup, Jack-of-quite-a-few-trades, Commodore Engineering.
  43. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
  44. Disclaimer: Nothing I say is anything other than my personal opinion.
  45.