home *** CD-ROM | disk | FTP | other *** search
- 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
- From: heinz@edohwg.adsp.sub.org (Heinz Wrobel)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: How to program multi-threaded programs on Amiga ?
- Message-ID: <heinz.04i5@edohwg.adsp.sub.org>
- Date: 6 Nov 92 23:29:02 GMT
- References: <36604@cbmvax.commodore.com> <RNlXr*DG7@garfield.fipnet.fi>
- Organization: Edotronik GmbH
- Lines: 33
-
- In article <RNlXr*DG7@garfield.fipnet.fi> vsaari@garfield.fipnet.fi (Ville Saari) writes:
- >What is the right way for sub-process to exit and how can the main process
- >be absolutely sure the sub-process has exited?
-
- How about this pseudocode at the end of your sub process:
-
- Signal(the_main_process, i_want_to_go_sigmask);
- Forbid();
- Wait(ok_to_go_sigmask);
- Signal(the_main_process, i_am_gone_now_sigmask);
- [finalrts]
-
- You signal the main process in some way that you want to go. Then you
- forbid and break the forbid by waiting on an acknowledge signal. As soon as
- the main process acknowledged your request, you're forbidden again. The
- final rts, exit, whatever will remove your process immediately because of
- the Forbid(). You're safely gone as soon as you get the acknowledge. The
- main process can depend on that when it wakes up after Wait()ing on the
- "i_am_gone" mask.
-
- There are probably more trivial ways depending on the exact behaviour of
- your sub-process.
-
-
- > Ville Saari vsaari@garfield.fipnet.fi ___ ____
-
- --
- Heinz Wrobel, Edotronik GmbH (ECG018)
- FAX +49 89 850 51 25 / TEL +49 89 850 25 20 (HOME!&VOICE, sometimes...)
- Path: cbmehq!cbmger!edohwg!heinz@cbmvax.commodore.com
- "It's good to have a mouse, it's faster if you can do without one..."
- "He who doesn't develop with an A2024 doesn't know about font independent
- user interfaces..."
-