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