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

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!nigel.msen.com!hela.iti.org!cs.widener.edu!dsinc!bagate!cbmvax!cbmehq!cbmger!edohwg!heinz
  2. From: heinz@edohwg.adsp.sub.org (Heinz Wrobel)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re:  How to program multi-threaded programs on Amiga ?
  5. Message-ID: <heinz.04i5@edohwg.adsp.sub.org>
  6. Date: 6 Nov 92 23:29:02 GMT
  7. References: <36604@cbmvax.commodore.com> <RNlXr*DG7@garfield.fipnet.fi>
  8. Organization: Edotronik GmbH
  9. Lines: 33
  10.  
  11. In article <RNlXr*DG7@garfield.fipnet.fi> vsaari@garfield.fipnet.fi (Ville Saari) writes:
  12. >What is the right way for sub-process to exit and how can the main process
  13. >be absolutely sure the sub-process has exited?
  14.  
  15. How about this pseudocode at the end of your sub process:
  16.  
  17.     Signal(the_main_process, i_want_to_go_sigmask);
  18.     Forbid();
  19.     Wait(ok_to_go_sigmask);
  20.     Signal(the_main_process, i_am_gone_now_sigmask);
  21.     [finalrts]
  22.  
  23. You signal the main process in some way that you want to go. Then you
  24. forbid and break the forbid by waiting on an acknowledge signal. As soon as
  25. the main process acknowledged your request, you're forbidden again. The
  26. final rts, exit, whatever will remove your process immediately because of
  27. the Forbid(). You're safely gone as soon as you get the acknowledge. The
  28. main process can depend on that when it wakes up after Wait()ing on the
  29. "i_am_gone" mask.
  30.  
  31. There are probably more trivial ways depending on the exact behaviour of
  32. your sub-process.
  33.  
  34.  
  35. > Ville Saari              vsaari@garfield.fipnet.fi  ___     ____
  36.  
  37. --
  38. Heinz Wrobel, Edotronik GmbH (ECG018)
  39. FAX +49 89 850 51 25 / TEL +49 89 850 25 20 (HOME!&VOICE, sometimes...)
  40. Path: cbmehq!cbmger!edohwg!heinz@cbmvax.commodore.com
  41. "It's good to have a mouse, it's faster if you can do without one..."
  42. "He who doesn't develop with an A2024 doesn't know about font independent
  43.  user interfaces..."
  44.